Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370979 - New API for opening Transactions on a specific branch with durable locking ID
Summary: New API for opening Transactions on a specific branch with durable locking ID
Status: CLOSED WORKSFORME
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.1   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-08 12:03 EST by Alex Lagarde CLA
Modified: 2012-02-09 06:43 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Lagarde CLA 2012-02-08 12:03:04 EST
Hi everyone !

I'm currently playing with CDO branches, and I noticed that CDO does not provide API for opening transaction with durable locking ID on specific branches.

http://download.eclipse.org/modeling/emf/cdo/drops/I20120203-0410/help/org.eclipse.emf.cdo.doc/javadoc/org/eclipse/emf/cdo/transaction/CDOTransactionContainer.html

If there is no technical reason explaining this limitation, I think that the following methods should be added to CDOTransactionContainer : 
- openTransaction(String durableLockingID, CDOBranch branch, ResourceSet resourceSet)
- openTransaction(String durableLockingID, CDOBranch branch)

Alex
Comment 1 Eike Stepper CLA 2012-02-08 12:29:02 EST
Hi Alex,

Locks are generally scoped to a specific branch and can not be transfered to other branches. In addition to the absence of API for that there are server side checks to prevent from accidentally "reinterpreting" locks from other branches. This is by design and I can not see a reason why one would like to relax that. I'm closing this as WONTFIX until someone can explain to me why moving locks between branches makes sense.

Please note that durable locks really lock objects in a branch to a view/owner. That ownership can be transfered to other views, but nothing else.
Comment 2 Alex Lagarde CLA 2012-02-09 02:30:15 EST
Hi Eike,

thanks for your fast reply.

If I open a transaction on a branch b1, with enableLockindID() == true, and then try to reopen it later using my lockingID, will the transaction be opened automatically on the branch b1 ? If this is the case then the existing API fulfill my need.

I agree with you that transfering locks from one branch to another does not have any sense.
Comment 3 Eike Stepper CLA 2012-02-09 06:43:23 EST
Yes, this code in CDOViewImpl shows it:

  protected void doActivate() throws Exception
  {
    CDOSessionProtocol sessionProtocol = session.getSessionProtocol();
    if (durableLockingID != null)
    {
      CDOBranchPoint branchPoint = sessionProtocol.openView(viewID, isReadOnly(), durableLockingID);
      basicSetBranchPoint(branchPoint);
    }
    else
    {
      sessionProtocol.openView(viewID, isReadOnly(), this);
    }
  }

;-)