Page 1 of 1

docx4j starts with delay

PostPosted: Mon Apr 25, 2011 10:09 pm
by smer4
at the begin of docx4j programm of reading or writing the file there is a kinda 5 sec. delay. Compared to the apache POI which does the same instantly. What kind of problem could that be or its just a docx4j feature? :mrgreen:

Re: docx4j starts with delay

PostPosted: Tue Apr 26, 2011 6:51 pm
by Richard
This delay is caused by the JAXB initialization process. If you use log4j you can see the related "INFO Context - loading Context jc" output at the command line.
Some further research on the internet brings up the fact, that JAXB is the xml binding framework with the slowest initialization process.

Re: docx4j starts with delay

PostPosted: Thu Apr 28, 2011 9:11 am
by davebrown
I spent some time trying to minimize the delay, to no avail. There are just too many classes in the docx4j/JAXB hierarchy, and there's no way around loading a lot of them before you can do anything. Jason did some work separating some classes into separate JAXB context, presumably in an effort to minimize this delay.

The product where I use docx4j is in a server, so the delay is not too bad.