No subject


Fri Aug 6 17:04:17 PDT 2004


allows 'parentless' implementations. On the other hand, you will have to =
roll your own Node and Element implementations.


/pmn=20

-----Original Message-----=20
From: Martin Schulz [ mailto:schulz at videotron.ca]=20
Sent: Monday, November 11, 2002 2:45 AM=20
To: jdom-interest at jdom.org=20
Subject: [jdom-interest] Reusable JDOM Elements=20


Hi,=20

in a potentially busy server environment, I preconstruct and cache =
potentially many JDOM subtrees. Comes usage time, the subtree gets =
cloned and attached to a real Document, which is subsequently output to =
XML and sent out.

It appears wasteful to have to clone the Elements, even if they are not =
going to be changed, for the sole reason that they maintain a reference =
to their parent.  It seems also to be slightly convoluted to manage =
recycling of such subtrees.

Is there a good pattern or solution out there (JDOM or closely related) =
which allows me to build Document trees, which are only top-to-bottom =
connected or which allows to reuse the constant subtree(s) easily?

Thanks!=20

        Martin=20


---=20
Outgoing mail is certified Virus Free.=20
Checked by AVG anti-virus system ( http://www.grisoft.com).=20
Version: 6.0.385 / Virus Database: 217 - Release Date: 04/09/2002=20
 =20

_______________________________________________=20
To control your jdom-interest membership: =
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@your=
hos=20
t.com=20
###########################################=20

This message has been scanned by F-Secure Anti-Virus for Microsoft =
Exchange. For more information, connect to http://www.F-Secure.com/ =
_______________________________________________

To control your jdom-interest membership: =
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@your=
host.com


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.385 / Virus Database: 217 - Release Date: 04/09/2002



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.385 / Virus Database: 217 - Release Date: 04/09/2002



------_=_NextPart_001_01C28A06.D5D967F3
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3DWindows-1252">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D536143804-12112002>We do=20
something very similar in our application to what you're asking.&nbsp; =
When I=20
saw your question, I was curious to see the responses.&nbsp; Unless I=20
misunderstood you're situation you would like a cache of documents that =
you can=20
reuse to fulfill parts of various requests.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D536143804-12112002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D536143804-12112002>This=20
naturally implies though that you will require 2 copies of the document: =
one to=20
stay in the cache, and one to fulfill the request.&nbsp; Unless you =
don't need=20
to modify the document (or subtree) and you can pass it by reference in =
the=20
response.&nbsp; However, from your email, it sounds like you need a =
totally new=20
copy for the response.&nbsp; In that case I guess what you're trying to =
do is=20
just increase performance.&nbsp; I think the cache idea is good but I =
wonder if=20
you could also create an object pool.&nbsp; If possible, you might set a =
depth=20
for that pool that is maintained by another thread.&nbsp; Having that =
thread=20
keep the pool full in the background might allow for immediate responses =
to a=20
request.&nbsp; Of course this all depends on having enough resources and =

such.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D536143804-12112002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D536143804-12112002>Just=20
so you know, we pretty much always clone or detach the trees we want to=20
use.&nbsp; If you find a better way let me know.</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Arial Narrow" size=3D2><STRONG>ANDRES =
MARCH</STRONG></FONT></DIV>
<DIV><FONT face=3D"Arial Narrow" size=3D1>LEAD APPLICATION =
DEVELOPER</FONT></DIV>
<DIV><FONT face=3D"Arial Narrow" color=3D#000080 =
size=3D2>eHEALTHCONTRACTS,=20
INC.</FONT></DIV>
<DIV><FONT face=3D"Arial Narrow" size=3D1><A=20
href=3D"http://www.ehealthcontracts.com/">WWW.eHEALTHCONTRACTS.COM</A></F=
ONT></DIV>
<DIV><FONT face=3D"Arial Narrow" size=3D1>OFFICE: 510.581.5646 =
x205</FONT></DIV>
<DIV><FONT face=3D"Arial Narrow" size=3D1>MOBILE: =
415.999.6735</FONT></DIV>
<DIV><FONT face=3D"Arial Narrow" size=3D1>FAX: 510.582.8013</FONT></DIV>
<DIV>
<P style=3D"MARGIN-BOTTOM: 3px"><FONT face=3D"Arial Narrow"=20
size=3D2><EM>Note:</EM></FONT></P>
<P style=3D"MARGIN-TOP: 0px; MARGIN-BOTTOM: 3px"><FONT face=3D"Arial =
Narrow"=20
size=3D2><EM>The information contained in this message may be privileged =
and=20
confidential and protected from disclosure. If the reader of this =
message is not=20
the intended recipient, or an employee or agent responsible for =
delivering this=20
message to the intended recipient, you are hereby notified that any=20
dissemination, distribution or copying of this communication is strictly =

prohibited. If you have received this communication in error, please =
notify us=20
immediately by replying to the message and deleting it from your=20
computer.</EM></FONT></P>
<P style=3D"MARGIN-TOP: 0px"><FONT face=3D"Arial Narrow" =
size=3D2><EM>Thank you.=20
eHealthContracts, Inc.</EM></FONT></P></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B> Martin Schulz=20
  [mailto:schulz at videotron.ca]<BR><B>Sent:</B> Monday, November 11, 2002 =
5:37=20
  PM<BR><B>To:</B> jdom-interest at jdom.org<BR><B>Subject:</B> RE: =
[jdom-interest]=20
  Reusable JDOM Elements<BR><BR></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D870072701-12112002>Henry,</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D870072701-12112002>could you elaborate just a=20
little?</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D870072701-12112002>A=20
  straight forward reference counting implementation would be intrusive, =

  wouldn't it?</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D870072701-12112002>Then=20
  we would still have the problem that an element (or any other 'node') =
can just=20
  have one parent...</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D870072701-12112002>Am I=20
  correct in assuming that you used an external reference holder, which =
was=20
  then&nbsp;used to identify and detach&nbsp;the recyclable=20
  pieces?</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D870072701-12112002>Now=20
  for me that would only be half of the solution, as I would have to =
provide=20
  either a pooling solution for multiple</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D870072701-12112002>copies of these pieces, or implement a=20
  synchronization point for resource access.</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D870072701-12112002>Also=20
  was there a performance gain obtained in your =
solution?</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D870072701-12112002>Thanks!</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D870072701-12112002>&nbsp;&nbsp;&nbsp; =
Martin</SPAN></FONT></DIV>
  <BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
    <DIV></DIV>
    <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr =
align=3Dleft><FONT=20
    face=3DTahoma size=3D2>-----Original Message-----<BR><B>From:</B>=20
    jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org] =
<B>On=20
    Behalf Of </B>Henry Charlton<BR><B>Sent:</B> November 11, 2002 3:02=20
    PM<BR><B>To:</B> jdom-interest at jdom.org<BR><B>Subject:</B> RE:=20
    [jdom-interest] Reusable JDOM Elements<BR><BR></FONT></DIV>
    <P><FONT size=3D2>In the past, I have successfully combined JDOM =
Elements with=20
    reference counting.&nbsp; </FONT></P>
    <P><FONT size=3D2>Once the xml file was generated, I would traverse =
the=20
    document from the root element, making detach() calls.</FONT> =
</P><BR>
    <P><FONT size=3D2>--Henry</FONT> </P><BR><BR>
    <P><FONT size=3D2>-----Original Message-----</FONT> <BR><FONT =
size=3D2>From:=20
    Norrman Per [<A=20
    =
href=3D"mailto:per.norrman at canovia.se">mailto:per.norrman at canovia.se</A>]=
=20
    </FONT><BR><FONT size=3D2>Sent: Monday, November 11, 2002 4:25 =
AM</FONT>=20
    <BR><FONT size=3D2>To: 'Martin Schulz'; =
jdom-interest at jdom.org</FONT>=20
    <BR><FONT size=3D2>Subject: RE: [jdom-interest] Reusable JDOM =
Elements</FONT>=20
    </P><BR>
    <P><FONT size=3D2>Hi,</FONT> </P>
    <P><FONT size=3D2>From a quick glance, it appears that dom4j (<A=20
    href=3D"http://www.dom4j.org" =
target=3D_blank>http://www.dom4j.org</A>)=20
    </FONT><BR><FONT size=3D2>allows 'parentless' implementations. On =
the other=20
    hand, you will have to roll your own Node and Element=20
    implementations.</FONT></P><BR>
    <P><FONT size=3D2>/pmn</FONT> </P>
    <P><FONT size=3D2>-----Original Message-----</FONT> <BR><FONT =
size=3D2>From:=20
    Martin Schulz [<A=20
    href=3D"mailto:schulz at videotron.ca">mailto:schulz at videotron.ca</A>]=20
    </FONT><BR><FONT size=3D2>Sent: Monday, November 11, 2002 2:45 =
AM</FONT>=20
    <BR><FONT size=3D2>To: jdom-interest at jdom.org</FONT> <BR><FONT =
size=3D2>Subject:=20
    [jdom-interest] Reusable JDOM Elements</FONT> </P><BR>
    <P><FONT size=3D2>Hi,</FONT> </P>
    <P><FONT size=3D2>in a potentially busy server environment, I =
preconstruct and=20
    cache potentially many JDOM subtrees. Comes usage time, the subtree =
gets=20
    cloned and attached to a real Document, which is subsequently output =
to XML=20
    and sent out.</FONT></P>
    <P><FONT size=3D2>It appears wasteful to have to clone the Elements, =
even if=20
    they are not going to be changed, for the sole reason that they =
maintain a=20
    reference to their parent.&nbsp; It seems also to be slightly =
convoluted to=20
    manage recycling of such subtrees.</FONT></P>
    <P><FONT size=3D2>Is there a good pattern or solution out there =
(JDOM or=20
    closely related) which allows me to build Document trees, which are =
only=20
    top-to-bottom connected or which allows to reuse the constant =
subtree(s)=20
    easily?</FONT></P>
    <P><FONT size=3D2>Thanks!</FONT> </P>
    <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
size=3D2>Martin</FONT>=20
    </P><BR>
    <P><FONT size=3D2>---</FONT> <BR><FONT size=3D2>Outgoing mail is =
certified Virus=20
    Free.</FONT> <BR><FONT size=3D2>Checked by AVG anti-virus system (<A =

    href=3D"http://www.grisoft.com"=20
    target=3D_blank>http://www.grisoft.com</A>).</FONT> <BR><FONT =
size=3D2>Version:=20
    6.0.385 / Virus Database: 217 - Release Date: 04/09/2002</FONT> =
<BR><FONT=20
    size=3D2>&nbsp;</FONT> </P>
    <P><FONT =
size=3D2>_______________________________________________</FONT>=20
    <BR><FONT size=3D2>To control your jdom-interest membership: <A=20
    =
href=3D"http://lists.denveronline.net/mailman/options/jdom-interest/youra=
ddr at yourhos"=20
    =
target=3D_blank>http://lists.denveronline.net/mailman/options/jdom-intere=
st/youraddr at yourhos</A></FONT>=20
    <BR><FONT size=3D2>t.com</FONT> <BR><FONT=20
    size=3D2>###########################################</FONT> </P>
    <P><FONT size=3D2>This message has been scanned by F-Secure =
Anti-Virus for=20
    Microsoft Exchange. For more information, connect to <A=20
    href=3D"http://www.F-Secure.com/" =
target=3D_blank>http://www.F-Secure.com/</A>=20
    _______________________________________________</FONT></P>
    <P><FONT size=3D2>To control your jdom-interest membership: <A=20
    =
href=3D"http://lists.denveronline.net/mailman/options/jdom-interest/youra=
ddr at yourhost.com"=20
    =
target=3D_blank>http://lists.denveronline.net/mailman/options/jdom-intere=
st/youraddr at yourhost.com</A></FONT></P><BR>
    <P><FONT size=3D2>---<BR>Incoming mail is certified Virus =
Free.<BR>Checked by=20
    AVG anti-virus system (http://www.grisoft.com).<BR>Version: 6.0.385 =
/ Virus=20
    Database: 217 - Release Date: =
04/09/2002<BR></FONT></P></BLOCKQUOTE><BR>
  <P><FONT size=3D2>---<BR>Outgoing mail is certified Virus =
Free.<BR>Checked by=20
  AVG anti-virus system (http://www.grisoft.com).<BR>Version: 6.0.385 / =
Virus=20
  Database: 217 - Release Date:=20
04/09/2002<BR></FONT></P></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C28A06.D5D967F3--



More information about the jdom-interest mailing list