Hi,

The OJB default cache is global. that is Objects are unique across threads.
If you want to separate threads from each other use the
ObjectCachePerBrokerImpl class.
this cache implementation provides each broker instance with it's own
isolated cache region.

cheers,
Thomas

> -----Original Message-----
> From: Dougall Squair [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 30, 2003 9:09 AM
> To: 'OJB Users List'
> Subject: Questions on caching and threads 
> 
> 
> Hi, 
> 
> It appears that the cache returns the same object reference 
> for the same
> primary key. Does this 
> have threading implications?
> 
> E.g. (Where "query" is same for both threads) 
> 
> Thread # 1 
> 
> DataObject dataObject1 = (DataObject)
> persistenceBroker.getObjectByQuery(query); 
> dataObject1.setValue(value2); // <--- Posible thread conflict here as
> dataObject1 == dataObject2
> persistenceBroker.store(dataObject1);  
> 
> Thread # 2
> 
> DataObject dataObject2 = (DataObject)
> persistenceBroker.getObjectByQuery(query); 
> dataObject1.setValue(value2);
> persistenceBroker.store(dataObject2);
> 
> 
> Even though the two Threads are within the context of 
> separate transactions
> they 
> seem to be both able to alter the value of the cached object.
> 
> 
> Regards 
> 
> Dougall
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Reply via email to