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 

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


Hi, 

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! 

        Martin 


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

_______________________________________________ 
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
<http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourho
s>  
t.com 
########################################### 

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

To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
<http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourho
st.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_01C28CC0.C654A240
Content-Type: text/html

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

<META content="MSHTML 5.50.4913.1100" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=799094615-15112002>In my 
implementation, I was able to identify user-defined types of JDOM elements, each 
supported by a factory.&nbsp; The factory supports recycling when its element 
pool is not empty, and would use object creation when it was.&nbsp; 
</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=799094615-15112002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=799094615-15112002>I used 
a mixin to add&nbsp;the necessary reuse methods to my user - defined 
classes.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=799094615-15112002></SPAN></FONT><FONT face=Arial color=#0000ff 
size=2><SPAN class=799094615-15112002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=799094615-15112002>I 
hesitate to attribute exact performance metrics to this technique, as the 
addition of reusable JDOM elements was part of a larger performance optimization 
effort, which addressed many other issues.&nbsp; However, having said that, the 
final result of the performance improvement efforts was that we saw an 8 - fold 
increase in the file throughput of our application.&nbsp; Obviously, 
the&nbsp;memory requirements of our application fell 
dramatically.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=799094615-15112002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=799094615-15112002>I 
would like to put in a plug for a resource that I found most helpful in our 
efforts:</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=799094615-15112002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=799094615-15112002>"Java 
Performance Tuning" by Jack Shirazi, O'Reilly &amp; Associates ISBN 
0-596-00015-4</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=799094615-15112002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=799094615-15112002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=799094615-15112002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=799094615-15112002>--Henry</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=799094615-15112002></SPAN></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Martin Schulz 
  [mailto:schulz at videotron.ca] <BR><B>Sent:</B> Monday, November 11, 2002 7:37 
  PM<BR><B>To:</B> jdom-interest at jdom.org<BR><B>Subject:</B> RE: [jdom-interest] 
  Reusable JDOM Elements<BR><BR></FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
  class=870072701-12112002>Henry,</SPAN></FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
  class=870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
  class=870072701-12112002>could you elaborate just a 
little?</SPAN></FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
  class=870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=870072701-12112002>A 
  straight forward reference counting implementation would be intrusive, 
  wouldn't it?</SPAN></FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=870072701-12112002>Then 
  we would still have the problem that an element (or any other 'node') can just 
  have one parent...</SPAN></FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
  class=870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=870072701-12112002>Am I 
  correct in assuming that you used an external reference holder, which was 
  then&nbsp;used to identify and detach&nbsp;the recyclable 
  pieces?</SPAN></FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
  class=870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=870072701-12112002>Now 
  for me that would only be half of the solution, as I would have to provide 
  either a pooling solution for multiple</SPAN></FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
  class=870072701-12112002>copies of these pieces, or implement a 
  synchronization point for resource access.</SPAN></FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
  class=870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=870072701-12112002>Also 
  was there a performance gain obtained in your solution?</SPAN></FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
  class=870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
  class=870072701-12112002>Thanks!</SPAN></FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
  class=870072701-12112002></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
  class=870072701-12112002>&nbsp;&nbsp;&nbsp; Martin</SPAN></FONT></DIV>
  <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
    <DIV></DIV>
    <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
    face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> 
    jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org] <B>On 
    Behalf Of </B>Henry Charlton<BR><B>Sent:</B> November 11, 2002 3:02 
    PM<BR><B>To:</B> jdom-interest at jdom.org<BR><B>Subject:</B> RE: 
    [jdom-interest] Reusable JDOM Elements<BR><BR></FONT></DIV>
    <P><FONT size=2>In the past, I have successfully combined JDOM Elements with 
    reference counting.&nbsp; </FONT></P>
    <P><FONT size=2>Once the xml file was generated, I would traverse the 
    document from the root element, making detach() calls.</FONT> </P><BR>
    <P><FONT size=2>--Henry</FONT> </P><BR><BR>
    <P><FONT size=2>-----Original Message-----</FONT> <BR><FONT size=2>From: 
    Norrman Per [<A 
    href="mailto:per.norrman at canovia.se">mailto:per.norrman at canovia.se</A>] 
    </FONT><BR><FONT size=2>Sent: Monday, November 11, 2002 4:25 AM</FONT> 
    <BR><FONT size=2>To: 'Martin Schulz'; jdom-interest at jdom.org</FONT> 
    <BR><FONT size=2>Subject: RE: [jdom-interest] Reusable JDOM Elements</FONT> 
    </P><BR>
    <P><FONT size=2>Hi,</FONT> </P>
    <P><FONT size=2>From a quick glance, it appears that dom4j (<A target=_blank 
    href="http://www.dom4j.org">http://www.dom4j.org</A>) </FONT><BR><FONT 
    size=2>allows 'parentless' implementations. On the other hand, you will have 
    to roll your own Node and Element implementations.</FONT></P><BR>
    <P><FONT size=2>/pmn</FONT> </P>
    <P><FONT size=2>-----Original Message-----</FONT> <BR><FONT size=2>From: 
    Martin Schulz [<A 
    href="mailto:schulz at videotron.ca">mailto:schulz at videotron.ca</A>] 
    </FONT><BR><FONT size=2>Sent: Monday, November 11, 2002 2:45 AM</FONT> 
    <BR><FONT size=2>To: jdom-interest at jdom.org</FONT> <BR><FONT size=2>Subject: 
    [jdom-interest] Reusable JDOM Elements</FONT> </P><BR>
    <P><FONT size=2>Hi,</FONT> </P>
    <P><FONT size=2>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.</FONT></P>
    <P><FONT size=2>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.&nbsp; It seems also to be slightly convoluted to 
    manage recycling of such subtrees.</FONT></P>
    <P><FONT size=2>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?</FONT></P>
    <P><FONT size=2>Thanks!</FONT> </P>
    <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>Martin</FONT> 
    </P><BR>
    <P><FONT size=2>---</FONT> <BR><FONT size=2>Outgoing mail is certified Virus 
    Free.</FONT> <BR><FONT size=2>Checked by AVG anti-virus system (<A 
    target=_blank 
    href="http://www.grisoft.com">http://www.grisoft.com</A>).</FONT> <BR><FONT 
    size=2>Version: 6.0.385 / Virus Database: 217 - Release Date: 
    04/09/2002</FONT> <BR><FONT size=2>&nbsp;</FONT> </P>
    <P><FONT size=2>_______________________________________________</FONT> 
    <BR><FONT size=2>To control your jdom-interest membership: <A target=_blank 
    href="http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos">http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos</A></FONT> 
    <BR><FONT size=2>t.com</FONT> <BR><FONT 
    size=2>###########################################</FONT> </P>
    <P><FONT size=2>This message has been scanned by F-Secure Anti-Virus for 
    Microsoft Exchange. For more information, connect to <A target=_blank 
    href="http://www.F-Secure.com/">http://www.F-Secure.com/</A> 
    _______________________________________________</FONT></P>
    <P><FONT size=2>To control your jdom-interest membership: <A target=_blank 
    href="http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com">http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com</A></FONT></P><BR>
    <P><FONT size=2>---<BR>Incoming mail is certified Virus Free.<BR>Checked by 
    AVG anti-virus system (http://www.grisoft.com).<BR>Version: 6.0.385 / Virus 
    Database: 217 - Release Date: 04/09/2002<BR></FONT></P></BLOCKQUOTE><BR>
  <P><FONT size=2>---<BR>Outgoing mail is certified Virus Free.<BR>Checked by 
  AVG anti-virus system (http://www.grisoft.com).<BR>Version: 6.0.385 / Virus 
  Database: 217 - Release Date: 
04/09/2002<BR></FONT></P></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C28CC0.C654A240--



More information about the jdom-interest mailing list