diff --git a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java index 43ac23d62f..0d93fb2826 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java @@ -96,7 +96,6 @@ public class AMQMessageStore implements MessageStore{ */ public void addMessage(ConnectionContext context,final Message message) throws IOException{ final MessageId id=message.getMessageId(); - final Location location=peristenceAdapter.writeCommand(message,message.isResponseRequired()); if(!context.isInTransaction()){ if(debug) @@ -341,8 +340,7 @@ public class AMQMessageStore implements MessageStore{ try{ referenceStore.removeMessage(transactionTemplate.getContext(),ack); }catch(Throwable e){ - e.printStackTrace(); - log.debug("Message could not be removed from long term store: "+e.getMessage(),e); + log.warn("Message could not be removed from long term store: "+e.getMessage(),e); } } } @@ -407,6 +405,7 @@ public class AMQMessageStore implements MessageStore{ } public void stop() throws Exception{ + flush(); asyncWriteTask.shutdown(); referenceStore.stop(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java index 5319891aab..bcb6a4883d 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java @@ -201,6 +201,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, } public void stop() throws Exception{ + if(!started.compareAndSet(true,false)) return; this.usageManager.removeUsageListener(this); @@ -236,10 +237,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, /** * When we checkpoint we move all the journalled data to long term storage. - * - * @param stopping - * - * @param b + * @param sync */ public void checkpoint(boolean sync){ try{ @@ -268,7 +266,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, /** * This does the actual checkpoint. * - * @return + * @return true if successful */ public boolean doCheckpoint(){ CountDownLatch latch=null;