users@jaxb.java.net

Re: JAXBContext and multithreading

From: Martin Bosak <bosakm_java_at_fmctc.com>
Date: Fri, 10 Jan 2003 23:22:33 -0600

Hi Kohsuke,

The schema is the IFX version 1.3.0 message schema. It is a HUGE schema.
JAXB generated approximately 1600 interface source files alone. Add the
1600 implementation classes and the Unmarshaller inner classes (when they
are compiled), and you get about 4800 .class files. Becuase the
ObjectFactory's static initialization block sets the default implementation
mapping with the com.sun.xml.bind.ImplementationRegistry all the .class
files have to be loaded.

Marty

----- Original Message -----
From: "Kohsuke Kawaguchi" <Kohsuke.Kawaguchi_at_Sun.COM>
To: <JAXB-INTEREST_at_JAVA.SUN.COM>
Sent: Friday, January 10, 2003 9:08 AM
Subject: Re: JAXBContext and multithreading


> > Is it threadsafe to have multiple threads accessing the same JAXBContext
> > object to obtain Marshallers and Unmarshallers? I have a schema where it
> > literally takes over one minute to create a JAXBContext object (on a
> > 1.6GH PC) and I so I need to create one instance at process startup and
> > cache it for later use during document processing.
>
> With JAXB RI, yes, JAXBContext is a thread-safe object, but other
> providers might choose to implement it in other ways.
>
> I'm also curious why it takes that long to create a JAXBContext object.
> Have you ever run the profiler? Could you tell me how large your schema
> is?
>
> regards,
> --
> Kohsuke KAWAGUCHI 408-276-7063 (x17063)
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>