diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPluginSupport.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPluginSupport.java index fe3e1baed9..d2ff04efb5 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPluginSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPluginSupport.java @@ -16,13 +16,16 @@ */ package org.apache.activemq.broker; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + /** * A useful base class for implementing broker plugins. * * @version $Revision$ */ public abstract class BrokerPluginSupport extends MutableBrokerFilter implements BrokerPlugin { - + private static final Log LOG = LogFactory.getLog(BrokerPluginSupport.class); public BrokerPluginSupport() { super(null); } @@ -32,4 +35,16 @@ public abstract class BrokerPluginSupport extends MutableBrokerFilter implements return this; } + @Override + public void start() throws Exception { + super.start(); + LOG.info("Broker Plugin " + getClass().getName() + " started"); + } + + @Override + public void stop() throws Exception { + super.stop(); + LOG.info("Broker Plugin " + getClass().getName() + " stopped"); + } + } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java b/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java index 803795b047..c3ee6d19d3 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java @@ -45,7 +45,7 @@ import org.apache.commons.logging.LogFactory; * @version $Revision$ */ public class TimeStampingBrokerPlugin extends BrokerPluginSupport { - + private static final Log LOG = LogFactory.getLog(TimeStampingBrokerPlugin.class); /** * variable which (when non-zero) is used to override * the expiration date for messages that arrive with @@ -85,15 +85,16 @@ public class TimeStampingBrokerPlugin extends BrokerPluginSupport { this.futureOnly = futureOnly; } - public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception { + @Override + public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception { if (message.getTimestamp() > 0 && (message.getBrokerPath() == null || message.getBrokerPath().length == 0)) { // timestamp not been disabled and has not passed through a network long oldExpiration = message.getExpiration(); long newTimeStamp = System.currentTimeMillis(); long timeToLive = zeroExpirationOverride; + long oldTimestamp = message.getTimestamp(); if (oldExpiration > 0) { - long oldTimestamp = message.getTimestamp(); timeToLive = oldExpiration - oldTimestamp; } if (timeToLive > 0 && ttlCeiling > 0 && timeToLive > ttlCeiling) { @@ -106,6 +107,9 @@ public class TimeStampingBrokerPlugin extends BrokerPluginSupport { message.setExpiration(expiration); } message.setTimestamp(newTimeStamp); + if (LOG.isDebugEnabled()) { + LOG.debug("Set message " + message.getMessageId() + " timestamp from " + oldTimestamp + " to " + newTimeStamp); + } } } super.send(producerExchange, message);