You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2010/01/18 20:52:51 UTC
svn commit: r900526 - in
/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker:
BrokerPluginSupport.java util/TimeStampingBrokerPlugin.java
Author: rajdavies
Date: Mon Jan 18 19:52:50 2010
New Revision: 900526
URL: http://svn.apache.org/viewvc?rev=900526&view=rev
Log:
added logging for Timestamp plugin
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPluginSupport.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPluginSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPluginSupport.java?rev=900526&r1=900525&r2=900526&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPluginSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerPluginSupport.java Mon Jan 18 19:52:50 2010
@@ -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 @@
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");
+ }
+
}
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java?rev=900526&r1=900525&r2=900526&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java Mon Jan 18 19:52:50 2010
@@ -45,7 +45,7 @@
* @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 @@
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 @@
message.setExpiration(expiration);
}
message.setTimestamp(newTimeStamp);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Set message " + message.getMessageId() + " timestamp from " + oldTimestamp + " to " + newTimeStamp);
+ }
}
}
super.send(producerExchange, message);