diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java index 197dfd454b..6dfc57d948 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java @@ -380,9 +380,9 @@ public final class AsyncDataManager { // Don't purge any data files past lastDataFile if( lastDataFile!=null ) { - for (Iterator iterator = unUsed.iterator(); iterator.hasNext();) { - DataFile dataFile = (DataFile)iterator.next(); - if( dataFile.getDataFileId() >= lastDataFile ) { + for (Iterator iterator = unUsed.iterator(); iterator.hasNext();) { + Integer i = iterator.next(); + if( i >= lastDataFile ) { iterator.remove(); } }