Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CD0] Read lock owners not being cleared after closing view(CDO CDOLock.isLockedByOthers)
[CD0] Read lock owners not being cleared after closing view [message #1834048] Sat, 31 October 2020 02:57 Go to next message
Jay Graham is currently offline Jay GrahamFriend
Messages: 13
Registered: September 2013
Junior Member
CDOLock.isLockedByOthers does not appear to be working in a multi-client environment.

I'm using CDO SDK version 5.4.

I have 2 clients connected to a CDO Server.

Client 1 opens a transaction and gets the read lock on a CDOResource R.

Client 2 gets the same CDOResource (R) and calls R.cdoReadLock().isLockedByOthers(), which returns true as expected.

Client 1 closes its transaction (which should release the read lock on R).

Client 2 calls R.cdoReadLock().isLockedByOthers() and again, true is returned, which is not expected.

Shouldn't the second call to isLockedByOthers() by Client 2 return false?

Running this same scenario using CDO SDK version 4.5 works as expected i.e., the second call to isLockedByOthers() returns false.

Any ideas?

Thank you,
Jay
Re: [CD0] Read lock owners not being cleared after closing view [message #1834050 is a reply to message #1834048] Sat, 31 October 2020 06:41 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
If you submit a bugzilla I can investigate. It would help me even more if you have a chance to write a test case for your scenario. Please have a look at https://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java for examples.

Re: [CD0] Read lock owners not being cleared after closing view [message #1834053 is a reply to message #1834050] Sat, 31 October 2020 12:15 Go to previous messageGo to next message
Jay Graham is currently offline Jay GrahamFriend
Messages: 13
Registered: September 2013
Junior Member
I'll take a look at LockingManagerTest.java to see if I can reproduce my scenario.

Thank you for the reply,
Jay
Re: [CD0] Read lock owners not being cleared after closing view [message #1834055 is a reply to message #1834050] Sat, 31 October 2020 13:06 Go to previous message
Jay Graham is currently offline Jay GrahamFriend
Messages: 13
Registered: September 2013
Junior Member
I believe this test reproduces my "2 Client" scenario:

public void testReadLockMultiClient() throws ConcurrentAccessException, CommitException
{
// Arrange.
CDOSession session1 = openSession();
CDOSession session2 = openSession();

// Client 1 creates and read-locks a resource.
CDOTransaction tx1 = session1.openTransaction();
tx1.options().setAutoReleaseLocksEnabled(false);
CDOResource resource1 = tx1.createResource(getResourcePath("/res1"));
tx1.commit();
resource1.cdoReadLock().lock();

// Client 2 gets the resource created and read-locked by Client 1.
CDOTransaction tx2 = session2.openTransaction();
CDOResource resource2 = tx2.getResource(getResourcePath("/res1"));

// Act.
final boolean isLockedByOthersBeforeClose = resource2.cdoReadLock().isLockedByOthers();
tx1.close(); // Client 1 release read lock.
final boolean isLockedByOthersAfterClose = resource2.cdoReadLock().isLockedByOthers();

// Assert.
assertTrue(isLockedByOthersBeforeClose);
assertFalse(isLockedByOthersAfterClose);
}
Previous Topic:[SOLVED] Hello, I have hit the "...exceeding the 65535 bytes limit". Any help?
Next Topic:Implement method in ecore
Goto Forum:
  


Current Time: Thu Apr 25 08:05:25 GMT 2024

Powered by FUDForum. Page generated in 0.02836 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top