git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@676636 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-07-14 15:59:12 +00:00
parent 8a6b0f1cf1
commit 4de4bc65f8
2 changed files with 7 additions and 3 deletions

View File

@ -72,6 +72,7 @@ public class AsyncDataManager {
public static final String DEFAULT_FILE_PREFIX = "data-"; public static final String DEFAULT_FILE_PREFIX = "data-";
public static final int DEFAULT_MAX_FILE_LENGTH = 1024 * 1024 * 32; public static final int DEFAULT_MAX_FILE_LENGTH = 1024 * 1024 * 32;
public static final int DEFAULT_CLEANUP_INTERVAL = 1000 * 30; 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); private static final Log LOG = LogFactory.getLog(AsyncDataManager.class);
@ -85,7 +86,7 @@ public class AsyncDataManager {
protected boolean useNio = true; protected boolean useNio = true;
protected int maxFileLength = DEFAULT_MAX_FILE_LENGTH; 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 DataFileAppender appender;
protected DataFileAccessorPool accessorPool = new DataFileAccessorPool(this); protected DataFileAccessorPool accessorPool = new DataFileAccessorPool(this);
@ -115,6 +116,7 @@ public class AsyncDataManager {
} }
started = true; started = true;
preferedFileLength=Math.max(PREFERED_DIFF, getMaxFileLength()-PREFERED_DIFF);
lock(); lock();
ByteSequence sequence = controlFile.load(); ByteSequence sequence = controlFile.load();
@ -427,11 +429,13 @@ public class AsyncDataManager {
List<DataFile> purgeList = new ArrayList<DataFile>(); List<DataFile> purgeList = new ArrayList<DataFile>();
for (Integer key : unUsed) { for (Integer key : unUsed) {
// Only add files less than the lastFile.. // Only add files less than the lastFile..
System.err.println("LAST FILE IS: " + lastFile);
if( key.intValue() < lastFile.intValue() ) { if( key.intValue() < lastFile.intValue() ) {
DataFile dataFile = (DataFile)fileMap.get(key); DataFile dataFile = (DataFile)fileMap.get(key);
purgeList.add(dataFile); purgeList.add(dataFile);
} }
} }
System.err.println("PURGE LIST IS: " + purgeList);
for (DataFile dataFile : purgeList) { for (DataFile dataFile : purgeList) {
forceRemoveDataFile(dataFile); forceRemoveDataFile(dataFile);
} }
@ -468,7 +472,7 @@ public class AsyncDataManager {
dataFile.unlink(); dataFile.unlink();
if (archiveDataLogs) { if (archiveDataLogs) {
dataFile.move(getDirectoryArchive()); dataFile.move(getDirectoryArchive());
LOG.debug("moved data file " + dataFile + " to " LOG.info("moved data file " + dataFile + " to "
+ getDirectoryArchive()); + getDirectoryArchive());
} else { } else {
boolean result = dataFile.delete(); boolean result = dataFile.delete();

View File

@ -231,10 +231,10 @@ public class AMQMessageStore implements MessageStore {
lock.lock(); lock.lock();
try { try {
inFlightTxLocations.remove(location); inFlightTxLocations.remove(location);
removeMessage(ack,location);
}finally { }finally {
lock.unlock(); lock.unlock();
} }
removeMessage(ack,location);
} }
public void afterRollback() throws Exception { public void afterRollback() throws Exception {