First question:
Does Xindice spawn threads for the storing of documents?
Second question:
I have a server wrapper class that handles all the application details
like permissions and such. Where I run in to a problem is my server is
designed to hand allot of asynchronous operations and on of these
operations is adding files to the Xindice server. It appears that if I
get two many add requests incoming to the server I get this exception:
rg.xmldb.api.base.XMLDBException: Java Runtime Error
at
org.apache.xindice.core.FaultCodes.createXMLDBException(FaultCodes.java:239)
at
org.apache.xindice.client.xmldb.CollectionImpl.storeResource(CollectionImpl.java:518)
at xmlserver.ServerThread.runAdd(ServerThread.java:158)
at xmlserver.ServerThread.run(ServerThread.java:50)
Now line number 158 points to this piece of code from my project.
I assumed that I wasn't synchronize my code correct at this spot so I
made a Object in my class and locked against it, but it appears that
dbCollection.storeResource(document) must be spawning a thread to store
the document thus my storeLock is getting unlocked prematurely.
synchronized (storeLock) {
// sleep(1000); // hack that allows a few more documents to be
// queued up
/*line #158:*/ dbCollection.storeResource(document);
}
Is there a way to fix this so that I can synchronize this statement or
another way to store documents that's thread safe?
I will appreciate any comments or suggestions.
Thanks
Todd Byrne