[jdom-interest] Reusable JDOM Elements

Andres March Andres at eHealthContracts.com
Mon Nov 11 20:49:08 PST 2002


We do something very similar in our application to what you're asking.  When I saw your question, I was curious to see the responses.  Unless I misunderstood you're situation you would like a cache of documents that you can reuse to fulfill parts of various requests.
 
This naturally implies though that you will require 2 copies of the document: one to stay in the cache, and one to fulfill the request.  Unless you don't need to modify the document (or subtree) and you can pass it by reference in the response.  However, from your email, it sounds like you need a totally new copy for the response.  In that case I guess what you're trying to do is just increase performance.  I think the cache idea is good but I wonder if you could also create an object pool.  If possible, you might set a depth for that pool that is maintained by another thread.  Having that thread keep the pool full in the background might allow for immediate responses to a request.  Of course this all depends on having enough resources and such.
 
Just so you know, we pretty much always clone or detach the trees we want to use.  If you find a better way let me know.
 
ANDRES MARCH
LEAD APPLICATION DEVELOPER
eHEALTHCONTRACTS, INC.
WWW.eHEALTHCONTRACTS.COM <http://www.ehealthcontracts.com/> 
OFFICE: 510.581.5646 x205
MOBILE: 415.999.6735
FAX: 510.582.8013

Note:

The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer.

Thank you. eHealthContracts, Inc.

-----Original Message-----
From: Martin Schulz [mailto:schulz at videotron.ca]
Sent: Monday, November 11, 2002 5:37 PM
To: jdom-interest at jdom.org
Subject: RE: [jdom-interest] Reusable JDOM Elements


Henry,
 
could you elaborate just a little?
 
A straight forward reference counting implementation would be intrusive, wouldn't it?
Then we would still have the problem that an element (or any other 'node') can just have one parent...
 
Am I correct in assuming that you used an external reference holder, which was then used to identify and detach the recyclable pieces?
 
Now for me that would only be half of the solution, as I would have to provide either a pooling solution for multiple
copies of these pieces, or implement a synchronization point for resource access.
 
Also was there a performance gain obtained in your solution?
 
Thanks!
 
    Martin

-----Original Message-----
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org] On Behalf Of Henry Charlton
Sent: November 11, 2002 3:02 PM
To: jdom-interest at jdom.org
Subject: RE: [jdom-interest] Reusable JDOM Elements



In the past, I have successfully combined JDOM Elements with reference counting.  

Once the xml file was generated, I would traverse the document from the root element, making detach() calls. 


--Henry 



-----Original Message----- 
From: Norrman Per [ mailto:per.norrman at canovia.se] 
Sent: Monday, November 11, 2002 4:25 AM 
To: 'Martin Schulz'; jdom-interest at jdom.org 
Subject: RE: [jdom-interest] Reusable JDOM Elements 


Hi, 



More information about the jdom-interest mailing list