OPENDJ-2543: ChangelogException while doing modrate on PDB instance.
Removed deadlock when next() has the object-lock and try to get the log
's shared-lock actually held by the abortAllCursor() doing an abort()
which is waiting for the object lock held by the caller of next().
| | |
| | | } |
| | | |
| | | @Override |
| | | public synchronized boolean next() throws ChangelogException |
| | | public boolean next() throws ChangelogException |
| | | { |
| | | // This lock is needed to ensure that abort() is atomic. |
| | | log.sharedLock.lock(); |
| | | try |
| | | { |
| | | if (mustAbort) |
| | | { |
| | |
| | | } |
| | | return delegate.next(); |
| | | } |
| | | finally |
| | | { |
| | | log.sharedLock.unlock(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void close() |
| | |
| | | /** |
| | | * Aborts this cursor. Once aborted, a cursor throws an |
| | | * AbortedChangelogCursorException if it is used. |
| | | * <p> |
| | | * This method is called only when log.exclusiveLock has been acquired. |
| | | * @GuardedBy("exclusiveLock") |
| | | */ |
| | | synchronized void abort() |
| | | void abort() |
| | | { |
| | | mustAbort = true; |
| | | } |