diff options
| author | Keith Wall <kwall@apache.org> | 2014-05-23 16:32:58 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2014-05-23 16:32:58 +0000 |
| commit | 54a17de77d2723d30098ec0790a320077d85270d (patch) | |
| tree | bbddf3c13adc3b7245dccf8e11402b19303c0cd1 /qpid/java/bdbstore | |
| parent | 30809559cc5b352515b75a961d0f10fdead81e2c (diff) | |
| download | qpid-python-54a17de77d2723d30098ec0790a320077d85270d.tar.gz | |
QPID-5784: [Java Broker] Prevent NPE possibility from BDB store\'s coalescing committer on shutdown
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1597122 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/bdbstore')
| -rw-r--r-- | qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java index a137e38baf..c9341dce02 100644 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java @@ -24,6 +24,7 @@ import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicBoolean; +import com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary; import org.apache.log4j.Logger; import org.apache.qpid.server.store.StoreFuture; @@ -242,6 +243,10 @@ public class CoalescingCommiter implements Committer for(int i = 0; i < size; i++) { BDBCommitFuture commit = _jobQueue.poll(); + if (commit == null) + { + break; + } commit.complete(); } @@ -255,6 +260,10 @@ public class CoalescingCommiter implements Committer for(int i = 0; i < size; i++) { BDBCommitFuture commit = _jobQueue.poll(); + if (commit == null) + { + break; + } commit.abort(e); } } @@ -302,10 +311,16 @@ public class CoalescingCommiter implements Committer { _stopped.set(true); BDBCommitFuture commit = null; + int abortedCommits = 0; while ((commit = _jobQueue.poll()) != null) { + abortedCommits++; commit.abort(e); } + if (LOGGER.isDebugEnabled() && abortedCommits > 0) + { + LOGGER.debug(abortedCommits + " commit(s) were aborted during close."); + } _lock.notifyAll(); } } |
