xml-xindice-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David J. Thomson" <dthom...@eecs.tufts.edu>
Subject Threading and Collections
Date Thu, 11 Sep 2003 14:13:16 GMT
Hello all,

I've been working on a problem for quite a while now and I would greatly
appreciate any insight. I'm using 1.1 b1 with the embed driver with jdk
1.4.1.

Essentially, I have one class that queries the database. It instantiates
it as such (exception handling removed):

Collection sc = null;
Database maindb = null;

         String driver =
"org.apache.xindice.client.xmldb.embed.DatabaseImpl";
         Class c = Class.forName(driver);

         maindb = (Database) c.newInstance();
         DatabaseManager.registerDatabase(maindb);


	   sc =
DatabaseManager.getCollection("xmldb:xindice-embed:///db/"+[collection_name]);


I have many threads trying to do this at once, and then querying it with
something like sc.listResources();.

Howevever, if one set of threads is using one collection, and another set
of threads is using another, they conflict and I keep getting a
NullPointerException. Do I need to make some sort of mutex locking to
ensure that only one collection is open at once? I was under the
impression that this wasn't so, but it appears otherwise. Thank you for
your advice.

Kind regards,
David




On Thu, 11 Sep 2003, Vadim Gritsenko wrote:

> David J. Thomson wrote:
>
> >Well, I think I've *almost* reproduced the problem consistently. I'm
> >afraid it has something to do with threading and having multiple
> >concurrent instances of a collection. It always seems to fail when trying
> >to instantiate a new CollectionManagementService, which returns null if
> >another open database inside another thread has already gotten a service.
> >
> >
>
> So, if I set off two-three threads simultaneously to get collection
> management service, it should fail? Good candidate for the unit test then.
>
>
> >Any ideas at all?
> >
> >
>
> No, I'm not that deep into xindice internals yet.
>
> Vadim
>
>
>



Mime
View raw message