directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <>
Subject Transactions and Search/Cursor
Date Tue, 20 Dec 2011 14:50:07 GMT

I have added txns support in LdapCoreSessionConnection, but I have some 
issues with searches : the txn has to remain opened until the cursor is 
closed. That means the cursor must retain the txns and that the commit 
is done in the cursor.close() operation.

I think we can use the inner ClosureMonitor to do that, but the question 
is what should we do when we get an exception during the search ? I 
would suggest that a search is done this way :

Cursor cursor = null;
   cursor = blah ) // The txn is started and stored 
into the ClosureMonitor

   while (
     Entry result = cursor.get();
     // do whatever is needed with the entry
   cursor.close(); // Here, the cursor holds the current status for the 
search : successful or failure.
    // If successful, do a commit, otherwise, do a rollback

Does it makes sense ?

Emmanuel L├ęcharny

View raw message