|
Re: [CDO] Concurrent accesses and ObjectNotFoundException [message #1699065 is a reply to message #1699056] |
Sat, 20 June 2015 05:27 |
|
Hi Stephane,
Your client B may want to use a (read) lock to ensure that the object under access is not deleted by other clients.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Am 20.06.2015 um 00:02 schrieb Stephane Fournier:
> Hi there,
>
> I'am facing an issue and I would like some suggestions to manage it correctly :)
>
> Let suppose you have 2 CDO clients (A & B) running in separate JVM connected to a CDO server (Mem Store) in a 3rd JVM.
>
> The metamodel is the following one :
>
> - Company contains Employees.
> - Employee has:
> - a name attribute (EString) , - lastUpdateDate containment relationship (MyDate)
> -MyDate - time attribute (ELong)
>
> Client A adds / removes employees in one Company instance "FooBarCompany" and is also be able to set a new MyDate
> instance on Employee instances let's say to date lastModification on it (dummy reason just for the use case).
>
> Client B runs a repeatable TimerTask each second: In this task, it does this :
>
> for (Employee current : company.getEmployees) {
> current.getLastUpdateDate().getTime()
> ....
> }
>
> But sometimes I got CDO ObjectNotFoundException on the call on getTime().
> Indeed, the object is changed in // by client A (the other client JVM) whereas client B is looping and trying to
> access the lastUpdateDate relationship which is removed on server side hence the object is not valid I guess because
> the client B transaction is not updated yet against the server ?
>
> I would really appreciate any suggestions to manage this kind of scenario properly.
>
> Should I only catch the exception and try to get the instance again ?
>
> What happens during the loop done by client B, if client A removes an Employee ? I suppose I will get the same CDO
> ObjectNotFound exception ?
>
> What is the right solution to manage this please ?
>
> Stéphane.
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Re: [CDO] Concurrent accesses and ObjectNotFoundException [message #1699077 is a reply to message #1699068] |
Sat, 20 June 2015 12:18 |
|
Am 20.06.2015 um 10:01 schrieb Stephane Fournier:
> Hi Eike,
>
> thanks again for your quick answer.
>
> I have already experiences how to lock objects with CDOAutoLocker handler but I don't know how to do quite the same
> thing at read time without explicitly doing :
>
> CDOLock cdoReadLock = company.cdoReadLock();
> cdoReadLock.lock(timeout);
>
> ...
> ..
> cdoReadLock.unlock();
>
> everywhere in the application code.
Locking is a pretty heavy mechanism in terms of signaling, too. Maybe you're better of by expecting respective
exceptions and handling them more gracefully, e.g. do the read again.
>
> By the way, if client A (JVM 1) uses CDOAutoLocker whereas client B (JVM 2) holds a ReadLock, client A trying to
> modify the same objects, will be blocked in the CDOAutoLocker until the client B has released its READ Lock ?
Yes.
> What happens if the client B JVM crashes ? the read lock is stil there ?
No, all locks are owned by the locking view/transaction and are released when that view/transaction is closed (for
whatever reason).
Please note that especially in this area I fixed some bugs for CDO 4.4.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Concurrent accesses and ObjectNotFoundException [message #1699541 is a reply to message #1699077] |
Wed, 24 June 2015 22:13 |
Stephane fournier Messages: 340 Registered: July 2009 |
Senior Member |
|
|
Hi Eike,
Thanks for your explanations.
I've just discovered the serializeCommits settings on server side.
To work with CDOMergingConflictREsolver, is it recommended to set it to true on server side with a mem store bad server ?
Thanks,
Stephane.
Eike Stepper wrote on Sat, 20 June 2015 08:18Am 20.06.2015 um 10:01 schrieb Stephane Fournier:
> Hi Eike,
>
> thanks again for your quick answer.
>
> I have already experiences how to lock objects with CDOAutoLocker handler but I don't know how to do quite the same
> thing at read time without explicitly doing :
>
> CDOLock cdoReadLock = company.cdoReadLock();
> cdoReadLock.lock(timeout);
>
> ...
> ..
> cdoReadLock.unlock();
>
> everywhere in the application code.
Locking is a pretty heavy mechanism in terms of signaling, too. Maybe you're better of by expecting respective
exceptions and handling them more gracefully, e.g. do the read again.
>
> By the way, if client A (JVM 1) uses CDOAutoLocker whereas client B (JVM 2) holds a ReadLock, client A trying to
> modify the same objects, will be blocked in the CDOAutoLocker until the client B has released its READ Lock ?
Yes.
> What happens if the client B JVM crashes ? the read lock is stil there ?
No, all locks are owned by the locking view/transaction and are released when that view/transaction is closed (for
whatever reason).
Please note that especially in this area I fixed some bugs for CDO 4.4.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03508 seconds