activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1306886 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
Date Thu, 29 Mar 2012 14:49:31 GMT
Author: tabish
Date: Thu Mar 29 14:49:31 2012
New Revision: 1306886

URL: http://svn.apache.org/viewvc?rev=1306886&view=rev
Log:
small cleanup: https://issues.apache.org/jira/browse/AMQ-3775 

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java?rev=1306886&r1=1306885&r2=1306886&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
Thu Mar 29 14:49:31 2012
@@ -1914,8 +1914,7 @@ public abstract class MessageDatabase ex
     // on a new message add, all existing subs are interested in this message
     private void addAckLocationForNewMessage(Transaction tx, StoredDestination sd, Long messageSequence)
throws IOException {
         for(String subscriptionKey : sd.subscriptionCache) {
-            SequenceSet sequences = null;
-            sequences = sd.ackPositions.get(tx, subscriptionKey);
+            SequenceSet sequences = sd.ackPositions.get(tx, subscriptionKey);
             if (sequences == null) {
                 sequences = new SequenceSet();
                 sequences.add(new Sequence(messageSequence, messageSequence + 1));
@@ -1945,19 +1944,16 @@ public abstract class MessageDatabase ex
             ArrayList<Long> unreferenced = new ArrayList<Long>();
 
             for(Long sequenceId : sequences) {
-                long references = 0;
-                Long count = sd.messageReferences.get(sequenceId);
-                if (count != null) {
-                    references = count.longValue() - 1;
-                } else {
-                    continue;
-                }
+                Long references = sd.messageReferences.get(sequenceId);
+                if (references != null) {
+                    references = references.longValue() - 1;
 
-                if (references > 0) {
-                    sd.messageReferences.put(sequenceId, Long.valueOf(references));
-                } else {
-                    sd.messageReferences.remove(sequenceId);
-                    unreferenced.add(sequenceId);
+                    if (references.longValue() > 0) {
+                        sd.messageReferences.put(sequenceId, references);
+                    } else {
+                        sd.messageReferences.remove(sequenceId);
+                        unreferenced.add(sequenceId);
+                    }
                 }
             }
 



Mime
View raw message