You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2014/05/23 18:32:58 UTC

svn commit: r1597122 - /qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java

Author: kwall
Date: Fri May 23 16:32:58 2014
New Revision: 1597122

URL: http://svn.apache.org/r1597122
Log:
QPID-5784: [Java Broker] Prevent NPE possibility from BDB store\'s coalescing committer on shutdown

Modified:
    qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java

Modified: qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java?rev=1597122&r1=1597121&r2=1597122&view=diff
==============================================================================
--- qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java (original)
+++ qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CoalescingCommiter.java Fri May 23 16:32:58 2014
@@ -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 implemen
                 for(int i = 0; i < size; i++)
                 {
                     BDBCommitFuture commit = _jobQueue.poll();
+                    if (commit == null)
+                    {
+                        break;
+                    }
                     commit.complete();
                 }
 
@@ -255,6 +260,10 @@ public class CoalescingCommiter implemen
                     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 implemen
             {
                 _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();
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org