Making the removeDataFile a little smarter to avoid removing data files that are still being worked on

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@741600 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2009-02-06 15:54:19 +00:00
parent 51e82d59e7
commit 789ea7cab9
1 changed files with 6 additions and 4 deletions

View File

@ -295,12 +295,14 @@ public class Journal {
public synchronized void removeDataFiles(Set<Integer> files) throws IOException {
for (Integer key : files) {
// Can't remove the data file (or subsequent files) that is currently being written to.
if( key >= lastAppendLocation.get().getDataFileId() ) {
continue;
}
DataFile dataFile = fileMap.get(key);
// Can't remove the last file.
if( dataFile == dataFiles.getTail() ) {
continue;
if( dataFile!=null ) {
forceRemoveDataFile(dataFile);
}
forceRemoveDataFile(dataFile);
}
}