Hi,
I'm creating separate threads with
ERXTaskThreadPoolExecutor/ERXRunnable's and those are working fine using my
default EOF access each creating and using an EOEditingContext.
However, now I need to access a different database as well within the threads. This
is how I am creating the EOEditingContext for this additional database -
calling a method that does this -
EOObjectStoreCoordinator
objectStoreCoordinator =
objectStoreForEGMLocation.get(eGMLocationId);
if(objectStoreCoordinator
== null) {
objectStoreCoordinator
= new
ERXObjectStoreCoordinator();
EOModelGroup.setModelGroupForObjectStoreCoordinator(
objectStoreCoordinator,
modelGroupForEGMLocation(eGMLocationId));
objectStoreForEGMLocation.put(eGMLocationId,
objectStoreCoordinator);
}
return ERXEC.newEditingContext(objectStoreCoordinator);
It creates the new database's EOEditingContext fine in each
of the threads, locks(). But then only one thread runs the SQL in it and
then the others are stuck at trying to do the SQL access - never show any SQL execution
and the threads simple wait. I am doing a
try
{ ec.lock(); ..... finally {ec.unlock();
}
for all of them to make sure the individual editingcontexts
are properly unlocking.
Any idea why they may be blocking/locking using these type
of EOEditingContext when the defeault editing contexts in these threads work
fine? I am assuming that somehow it is the same EOEditingContext. I
printed the hashcode value for all of them and they're different but maybe the
underlying object cache is the same. Should I create the
EOEditingContext differently?
Thanks for any help,
Mark