users@jaxb.java.net

About releasing resources using Jaxb

From: <Patrizio.Ferlito_at_bosslab.ch>
Date: Wed, 17 Sep 2003 10:39:10 +0200

Dear JAxbTeam,
 
I've just downloaded Jaxb and the user guide. I'm using it for extracting
information from an XML document to allocate other helper data structure.
Reading the Java API documentation, the user guide and the FAQ I've found no
information about how releasing resources using Jaxb so I'm asking to myself
if I'm using correctly Jaxb.
 
My question is very simple.
In the next lines I reported a bit of my example code:
 
         private void readXMLServicesRepository(String xmlFile)
         {
                 InputStream configpStream =
this.getClass().getResourceAsStream(xmlFile);
                 Repository repository = null;
                 try
                 {
                         if (configpStream == null)
                         {
                                 BEBException ex = new BEBException("Unable
to load " + xmlFile + " file !");
                                 ...
                         }
                         JAXBContext ctx =
JAXBContext.newInstance("com.bosslab.abs.beb.sa.xml.services");
                         Unmarshaller u = ctx.createUnmarshaller();
                         repository = (Repository)
u.unmarshal(configpStream);
                 }
                 catch (Exception e)
                 {
                         ....
                 }
                 // now I'm extracting information navigating the repository
object ...
                 ...
                 List servicesList = repository.getService();
                 int size = servicesList.size();
                 for (int i = 0; i < size; i++)
                 {
                         // Store specific extracted information into some
private member objects of the class
                         ...
                 }
 
                 // At the end, have I to call some close/destroy methods on
Jaxb objects ?
         }
 
So, after having worked with Jaxb objects, have I to call some
close/destroy methods on Jaxb objects ?
In my example, I used only local Jaxb objects, so garbage collector should
free memory when the JVM memory goes short.
Do you suggest to set the local Jaxb objects to null at the end ?
 
I write you this question, because I noted the following behaviour using
Jaxb & Weblogic 8 under Solaris 8 machine.
We got an error like the following:
 
 
>>>>>Process.isValidIP() -> 02
>>>>>Process.isValidIP() -> 06
 
Failed to find host: java.net.UnknownHostException: labo0420: labo0420
 
We use JAXB objects in an our startup class, if we start Weblogic 8 without
this startup class, the problem didn't arise.
We tried also to increase the "initial Java heap size" (the -Xms<size>
option) and the problem was solved.
 
I thank you, in any case, for any your feedback.
Kind regards
Patrizio Ferlito




IMPORTANT:
This e-mail transmission is intended for the named addressee(s) only.
Its contents are private, confidential and protected from disclosure and
should not be read, copied or disclosed by any other person.
If you are not the intended recipient, we kindly ask you to notify the
sender immediately by telephone (+41-91-612 26 11),
to redirect the message to the account "info_at_bosslab.ch" and to delete this
e-mail.
E-mail transmissions may be intercepted, altered or read by unauthorized
persons and may contain viruses. Therefore, it is recommended that you use
regular mail or courier services for any information intended to be
confidential. However, by sending us messages through e-mail, you authorize
and instruct us to correspond by e-mail in the relevant matter.
Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net