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 | 78e1d29ecefa2db572cbcc8158792133302aba9f (patch) | |
tree | 72c765f520d806f67eaf7974c3cfc341d4cfb597 | |
parent | 0c839dc7a1ca94f91dfda29134c3feffe3d6d3d5 (diff) | |
download | qpid-python-78e1d29ecefa2db572cbcc8158792133302aba9f.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/qpid@1597122 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java b/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java index a137e38baf..c9341dce02 100644 --- a/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java +++ b/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(); } } |