Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » CDO lock/unlock model event(How to listen the CDO lock/unlock event between all the clients?)
CDO lock/unlock model event [message #1006414] Thu, 31 January 2013 04:55 Go to next message
Huang Karelun is currently offline Huang Karelun
Messages: 4
Registered: January 2013
Junior Member
    1.I used CDO for connecting between mult-clients and server.

    2.In one client, I used this code
    CDOUtil.getCDOObject((EObject)object).cdoWriteLock().lock();
    to lock one model which defined by EMF. then I can catch the
    CDOSessionLocksChangedEvent
    by listening the CDOSession listeners in the current client, which it's correctly.

    3.But In other clients, I can't catch the
    CDOSessionLocksChangedEvent
    with the same method. so can you tell me how to catch it in other clients, and which it's important for me!

    4.Lastly, My main meaning is: one client locks/unlocks one model, the other clients also should catch the lock/unlock event.

    5.By the way, the version of CDO what I used is 4.1.

Thank for your answers!
Re: CDO lock/unlock model event [message #1006597 is a reply to message #1006414] Fri, 01 February 2013 01:44 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5501
Registered: July 2009
Senior Member
Am 31.01.2013 15:23, schrieb Huang Karelun:
> 1.I used CDO for connecting between mult-clients and server.
> 2.In one client, I used this code CDOUtil.getCDOObject((EObject)object).cdoWriteLock().lock(); to lock one model which
> defined by EMF.
Have you regenerated your model for CDO? If so you would just call object.cdoWriteLock().lock();

> then I can catch the CDOSessionLocksChangedEvent by listening the CDOSession listeners in the current client, which
> it's correctly.
> 3.But In other clients, I can't catch the CDOSessionLocksChangedEvent with the same method. so can you tell me how to
> catch it in other clients, and which it's important for me!
You need to enable this functionality via CDOCommonSession.Options.setLockNotificationMode(LockNotificationMode).

> 4.Lastly, My main meaning is: one client locks/unlocks one model, the other clients also should catch the lock/unlock
> event.
Hmm, how is this different from your question 3?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


> 5.By the way, the version of CDO what I used is 4.1.
> Thank for your answers!
Re: CDO lock/unlock model event [message #1007030 is a reply to message #1006597] Mon, 04 February 2013 01:56 Go to previous messageGo to next message
Huang Karelun is currently offline Huang Karelun
Messages: 4
Registered: January 2013
Junior Member
Maybe you misunderstand my description or I wrote it with no clearly. Now I will describe it again:
Firstly, what I've been finished with CDO successful like these:
1). Can connect between multi-clients and server.
2).In one client, use this code
CDOUtil.getcdoObject((EObject)object).cdoWriteLock().lock();
,I can lock one model, and can also listen the CDOSessionLocksChangedEvent in the current client by CDOSession.

Secondly, Now This is the problem:
1). When one client locks one model, other clients can not listen to the CDOSessionLocksChangedEvent, so they don't know whether any one model has been locked or not.

Thirdly, some extra info:
1). The CDO version is 4.1.
2). I've used your mentioned method:
transaction.getSession().options().setLockNotificationMode(LockNotificationMode.ALWAYS);
, but its still can not solve my problem.
Re: CDO lock/unlock model event [message #1007034 is a reply to message #1007030] Mon, 04 February 2013 02:48 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5501
Registered: July 2009
Senior Member
Am 04.02.2013 07:56, schrieb Huang Karelun:
> Maybe you misunderstand my description or I wrote it with no clearly. Now I will describe it again:
> Firstly, what I've been finished with CDO successful like these:
> 1). Can connect between multi-clients and server.
> 2).In one client, use this code CDOUtil.getcdoObject((EObject)object).cdoWriteLock().lock();,I can lock one model, and
> can also listen the CDOSessionLocksChangedEvent in the current client by CDOSession.
>
> Secondly, Now This is the problem:
> 1). When one client locks one model, other clients can not listen to the CDOSessionLocksChangedEvent, so they don't
> know whether any one model has been locked or not.
>
> Thirdly, some extra info:
> 1). The CDO version is 4.1.
> 2). I've used your mentioned
> method:transaction.getSession().options().setLockNotificationMode(LockNotificationMode.ALWAYS);, but its still can not
> solve my problem.
So, you say that you set LockNotificationMode.ALWAYS in the *receiving* client and add a listener to the *receiving*
client and then your listener does not receive any CDOSessionLocksChangedEvents?

Have you waited long enough for the receiving client to asynchronously process potential events? In test cases it's all
too easy to place an assertion into the test logic without a timeout.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: CDO lock/unlock model event [message #1007233 is a reply to message #1007034] Tue, 05 February 2013 02:50 Go to previous message
Huang Karelun is currently offline Huang Karelun
Messages: 4
Registered: January 2013
Junior Member
OK, I've solved it, and your answer is right, maybe i need to wait a moment for listening the lock event.
Thanks!
Previous Topic:[CDO] and eAdapters
Next Topic:Conditional loading of cross refs
Goto Forum:
  


Current Time: Wed Aug 27 19:16:40 EDT 2014

Powered by FUDForum. Page generated in 0.02046 seconds