activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r676636 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq: kaha/impl/async/AsyncDataManager.java store/amq/AMQMessageStore.java
Date Mon, 14 Jul 2008 15:59:13 GMT
Author: rajdavies
Date: Mon Jul 14 08:59:12 2008
New Revision: 676636

URL: http://svn.apache.org/viewvc?rev=676636&view=rev
Log:
Fix for https://issues.apache.org/activemq/browse/AMQ-1856

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java?rev=676636&r1=676635&r2=676636&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java
Mon Jul 14 08:59:12 2008
@@ -72,6 +72,7 @@
     public static final String DEFAULT_FILE_PREFIX = "data-";
     public static final int DEFAULT_MAX_FILE_LENGTH = 1024 * 1024 * 32;
     public static final int DEFAULT_CLEANUP_INTERVAL = 1000 * 30;
+    public static final int PREFERED_DIFF = 1024 * 512;
 
     private static final Log LOG = LogFactory.getLog(AsyncDataManager.class);
 
@@ -85,7 +86,7 @@
     protected boolean useNio = true;
 
     protected int maxFileLength = DEFAULT_MAX_FILE_LENGTH;
-    protected int preferedFileLength = DEFAULT_MAX_FILE_LENGTH - 1024 * 512;
+    protected int preferedFileLength = DEFAULT_MAX_FILE_LENGTH - PREFERED_DIFF;
 
     protected DataFileAppender appender;
     protected DataFileAccessorPool accessorPool = new DataFileAccessorPool(this);
@@ -115,6 +116,7 @@
         }
 
         started = true;
+        preferedFileLength=Math.max(PREFERED_DIFF, getMaxFileLength()-PREFERED_DIFF);
         lock();
 
         ByteSequence sequence = controlFile.load();
@@ -427,11 +429,13 @@
         List<DataFile> purgeList = new ArrayList<DataFile>();
         for (Integer key : unUsed) {
         	// Only add files less than the lastFile..
+            System.err.println("LAST FILE IS: " + lastFile);
         	if( key.intValue() < lastFile.intValue() ) {
                 DataFile dataFile = (DataFile)fileMap.get(key);
                 purgeList.add(dataFile);
         	}
         }
+        System.err.println("PURGE LIST IS: " + purgeList);
         for (DataFile dataFile : purgeList) {
             forceRemoveDataFile(dataFile);
         }
@@ -468,7 +472,7 @@
         dataFile.unlink();
         if (archiveDataLogs) {
             dataFile.move(getDirectoryArchive());
-            LOG.debug("moved data file " + dataFile + " to "
+            LOG.info("moved data file " + dataFile + " to "
                     + getDirectoryArchive());
         } else {
             boolean result = dataFile.delete();

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java?rev=676636&r1=676635&r2=676636&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java
Mon Jul 14 08:59:12 2008
@@ -231,10 +231,10 @@
                     lock.lock();
                     try {
                         inFlightTxLocations.remove(location);
-                        removeMessage(ack,location);
                     }finally {
                         lock.unlock();
                     }
+                    removeMessage(ack,location);
                 }
 
                 public void afterRollback() throws Exception {



Mime
View raw message