activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1063669 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
Date Wed, 26 Jan 2011 10:40:35 GMT
Author: gtully
Date: Wed Jan 26 10:40:35 2011
New Revision: 1063669

URL: http://svn.apache.org/viewvc?rev=1063669&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3162 - ActiveMQ checkpoint worker makes unnecessary
repeated calls to Journal.getFileMap(), leading to excessive memory usage
applied variation of the patch with thanks. Now make one call to find the current set of referenced
files.

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=1063669&r1=1063668&r2=1063669&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
Wed Jan 26 10:40:35 2011
@@ -1137,8 +1137,9 @@ public class MessageDatabase extends Ser
         pageFile.flush();
 
         if( cleanup ) {
-        	
-        	final TreeSet<Integer> gcCandidateSet = new TreeSet<Integer>(journal.getFileMap().keySet());
+
+            final TreeSet<Integer> completeFileSet = new TreeSet<Integer>(journal.getFileMap().keySet());
+            final TreeSet<Integer> gcCandidateSet = new TreeSet<Integer>(completeFileSet);
         	
         	// Don't GC files under replication
         	if( journalFilesBeingReplicated!=null ) {
@@ -1220,7 +1221,7 @@ public class MessageDatabase extends Ser
                 Set<Integer> referencedFileIds = ackMessageFileMap.get(candidate);
                 if (referencedFileIds != null) {
                     for (Integer referencedFileId : referencedFileIds) {
-                        if (journal.getFileMap().containsKey(referencedFileId) &&
!gcCandidates.contains(referencedFileId)) {
+                        if (completeFileSet.contains(referencedFileId) && !gcCandidates.contains(referencedFileId))
{
                             // active file that is not targeted for deletion is referenced
so don't delete
                             candidates.remove();
                             break;



Mime
View raw message