| | |
| | | // unlock it when throwing an exception. |
| | | dbCloseLock.readLock().lock(); |
| | | |
| | | boolean cursorHeld = false; |
| | | Cursor localCursor = null; |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | cursor = localCursor; |
| | | cursorHeld = cursor != null; |
| | | } |
| | | catch (ChangelogException e) |
| | | { |
| | |
| | | closeAndReleaseReadLock(localCursor); |
| | | throw new ChangelogException(e); |
| | | } |
| | | finally |
| | | { |
| | | if (!cursorHeld) |
| | | { |
| | | dbCloseLock.readLock().unlock(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private ReplServerDBCursor() throws ChangelogException |
| | |
| | | // We'll go on only if no close or no clear is running |
| | | dbCloseLock.readLock().lock(); |
| | | |
| | | boolean cursorHeld = false; |
| | | Transaction localTxn = null; |
| | | Cursor localCursor = null; |
| | | try |
| | |
| | | |
| | | txn = localTxn; |
| | | cursor = localCursor; |
| | | cursorHeld = cursor != null; |
| | | } |
| | | catch (ChangelogException e) |
| | | { |
| | |
| | | abort(localTxn); |
| | | throw new ChangelogException(e); |
| | | } |
| | | finally |
| | | { |
| | | if (!cursorHeld) |
| | | { |
| | | dbCloseLock.readLock().unlock(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void abort(Transaction localTxn) |