Upgrade to latest slf4j library and update many LOG statements to use
proper calls (no string concats).  Removes many uneeded isXXXEnabled
checks to clean up the code.
This commit is contained in:
Timothy Bish 2013-09-13 14:53:41 -04:00
parent cdb7bb11ff
commit e1bbde7302
96 changed files with 590 additions and 964 deletions

View File

@ -18,8 +18,6 @@ package org.apache.activemq.transport.amqp;
import org.apache.activemq.transport.nio.NIOSSLTransport;
import org.apache.activemq.wireformat.WireFormat;
import org.fusesource.hawtbuf.Buffer;
import org.fusesource.hawtbuf.DataByteArrayInputStream;
import javax.net.SocketFactory;
import java.io.IOException;

View File

@ -138,18 +138,12 @@ class AmqpProtocolConverter {
((TransportImpl) protonTransport).setProtocolTracer(new ProtocolTracer() {
@Override
public void receivedFrame(TransportFrame transportFrame) {
if (TRACE_FRAMES.isTraceEnabled()) {
TRACE_FRAMES.trace(String.format("%s | RECV: %s",
AmqpProtocolConverter.this.amqpTransport.getRemoteAddress(), transportFrame.getBody()));
}
TRACE_FRAMES.trace("{} | RECV: {}", AmqpProtocolConverter.this.amqpTransport.getRemoteAddress(), transportFrame.getBody());
}
@Override
public void sentFrame(TransportFrame transportFrame) {
if (TRACE_FRAMES.isTraceEnabled()) {
TRACE_FRAMES.trace(String.format("%s | SENT: %s",
AmqpProtocolConverter.this.amqpTransport.getRemoteAddress(), transportFrame.getBody()));
}
TRACE_FRAMES.trace("{} | SENT: {}", AmqpProtocolConverter.this.amqpTransport.getRemoteAddress(), transportFrame.getBody());
}
});
}
@ -359,8 +353,8 @@ class AmqpProtocolConverter {
ConsumerContext consumerContext = subscriptionsByConsumerId.get(md.getConsumerId());
if (consumerContext != null) {
// End of Queue Browse will have no Message object.
if (LOG.isTraceEnabled() && md.getMessage() != null) {
LOG.trace("Dispatching MessageId:{} to consumer", md.getMessage().getMessageId());
if (md.getMessage() != null) {
LOG.trace("Dispatching MessageId: {} to consumer", md.getMessage().getMessageId());
} else {
LOG.trace("Dispatching End of Browse Command to consumer {}", md.getConsumerId());
}
@ -373,9 +367,7 @@ class AmqpProtocolConverter {
} else if (command.isBrokerInfo()) {
// ignore
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Do not know how to process ActiveMQ Command " + command);
}
LOG.debug("Do not know how to process ActiveMQ Command {}", command);
}
}
@ -440,9 +432,7 @@ class AmqpProtocolConverter {
private void onSessionClose(Session session) {
AmqpSessionContext sessionContext = (AmqpSessionContext) session.getContext();
if (sessionContext != null) {
if (LOG.isTraceEnabled()) {
LOG.trace("Session {} closed", sessionContext.sessionId);
}
sendToActiveMQ(new RemoveInfo(sessionContext.sessionId), null);
session.setContext(null);
}
@ -473,7 +463,7 @@ class AmqpProtocolConverter {
} else if (transformer.equals(InboundTransformer.TRANSFORMER_RAW)) {
inboundTransformer = new AMQPRawInboundTransformer(ActiveMQJMSVendor.INSTANCE);
} else {
LOG.warn("Unknown transformer type " + transformer + ", using native one instead");
LOG.warn("Unknown transformer type {} using native one instead", transformer);
inboundTransformer = new AMQPNativeInboundTransformer(ActiveMQJMSVendor.INSTANCE);
}
}
@ -552,10 +542,7 @@ class AmqpProtocolConverter {
messageId.setProducerId(producerId);
messageId.setProducerSequenceId(messageIdGenerator.getNextSequenceId());
if (LOG.isTraceEnabled()) {
LOG.trace("Inbound Message:{} from Producer:{}", message.getMessageId(),
producerId + ":" + messageId.getProducerSequenceId());
}
LOG.trace("Inbound Message:{} from Producer:{}", message.getMessageId(), producerId + ":" + messageId.getProducerSequenceId());
DeliveryState remoteState = delivery.getRemoteState();
if (remoteState != null && remoteState instanceof TransactionalState) {
@ -621,7 +608,7 @@ class AmqpProtocolConverter {
}
final Object action = ((AmqpValue) msg.getBody()).getValue();
LOG.debug("COORDINATOR received: " + action + ", [" + buffer + "]");
LOG.debug("COORDINATOR received: {}, [{}]", action, buffer);
if (action instanceof Declare) {
Declare declare = (Declare) action;
if (declare.getGlobalId() != null) {
@ -631,9 +618,7 @@ class AmqpProtocolConverter {
long txid = nextTransactionId++;
TransactionInfo txinfo = new TransactionInfo(connectionId, new LocalTransactionId(connectionId, txid), TransactionInfo.BEGIN);
sendToActiveMQ(txinfo, null);
if (LOG.isTraceEnabled()) {
LOG.trace("started transaction " + txid);
}
LOG.trace("started transaction {}", txid);
Declared declared = new Declared();
declared.setTxnId(new Binary(toBytes(txid)));
@ -645,14 +630,10 @@ class AmqpProtocolConverter {
final byte operation;
if (discharge.getFail()) {
if (LOG.isTraceEnabled()) {
LOG.trace("rollback transaction " + txid);
}
LOG.trace("rollback transaction {}", txid);
operation = TransactionInfo.ROLLBACK;
} else {
if (LOG.isTraceEnabled()) {
LOG.trace("commit transaction " + txid);
}
LOG.trace("commit transaction {}", txid);
operation = TransactionInfo.COMMIT_ONE_PHASE;
}
@ -675,9 +656,7 @@ class AmqpProtocolConverter {
rejected.setError(createErrorCondition("failed", er.getException().getMessage()));
delivery.disposition(rejected);
}
if (LOG.isDebugEnabled()) {
LOG.debug("TX: {} settling {}", operation, action);
}
delivery.settle();
pumpProtonToSocket();
}
@ -937,9 +916,7 @@ class AmqpProtocolConverter {
dispatchedInTx.addFirst(md);
}
if (LOG.isTraceEnabled()) {
LOG.trace("Sending Ack to ActiveMQ: {}", ack);
}
sendToActiveMQ(ack, new ResponseHandler() {
@Override
@ -980,9 +957,7 @@ class AmqpProtocolConverter {
TransactionalState txState = (TransactionalState) state;
if (txState.getOutcome() instanceof DeliveryState) {
if (LOG.isTraceEnabled()) {
LOG.trace("onDelivery: TX delivery state = {}", state);
}
state = (DeliveryState) txState.getOutcome();
@ -995,9 +970,7 @@ class AmqpProtocolConverter {
}
} else {
if (state instanceof Accepted) {
if (LOG.isTraceEnabled()) {
LOG.trace("onDelivery: accepted state = {}", state);
}
if (!delivery.remotelySettled()) {
delivery.disposition(new Accepted());
@ -1006,14 +979,10 @@ class AmqpProtocolConverter {
} else if (state instanceof Rejected) {
// re-deliver /w incremented delivery counter.
md.setRedeliveryCounter(md.getRedeliveryCounter() + 1);
if (LOG.isTraceEnabled()) {
LOG.trace("onDelivery: Rejected state = {}, delivery count now {}", state, md.getRedeliveryCounter());
}
settle(delivery, -1);
} else if (state instanceof Released) {
if (LOG.isTraceEnabled()) {
LOG.trace("onDelivery: Released state = {}", state);
}
// re-deliver && don't increment the counter.
settle(delivery, -1);
} else if (state instanceof Modified) {
@ -1022,9 +991,7 @@ class AmqpProtocolConverter {
// increment delivery counter..
md.setRedeliveryCounter(md.getRedeliveryCounter() + 1);
}
if (LOG.isTraceEnabled()) {
LOG.trace("onDelivery: Modified state = {}, delivery count now {}", state, md.getRedeliveryCounter());
}
byte ackType = -1;
Boolean undeliverableHere = modified.getUndeliverableHere();
if (undeliverableHere != null && undeliverableHere) {
@ -1047,9 +1014,7 @@ class AmqpProtocolConverter {
pendingTxAck.setTransactionId(md.getMessage().getTransactionId());
pendingTxAck.setFirstMessageId(dispatchedInTx.getLast().getMessage().getMessageId());
if (LOG.isTraceEnabled()) {
LOG.trace("Sending commit Ack to ActiveMQ: {}", pendingTxAck);
}
dispatchedInTx.clear();
@ -1073,9 +1038,7 @@ class AmqpProtocolConverter {
void doRollback() throws Exception {
synchronized (outbound) {
if (LOG.isTraceEnabled()) {
LOG.trace("Rolling back {} messages for redelivery. ", dispatchedInTx.size());
}
for (MessageDispatch md : dispatchedInTx) {
md.setRedeliveryCounter(md.getRedeliveryCounter() + 1);
@ -1265,9 +1228,7 @@ class AmqpProtocolConverter {
void handleException(Throwable exception) {
exception.printStackTrace();
if (LOG.isDebugEnabled()) {
LOG.debug("Exception detail", exception);
}
try {
amqpTransport.stop();
} catch (Throwable e) {

View File

@ -87,8 +87,8 @@ public class AmqpTransportFilter extends TransportFilter implements AmqpTranspor
public void onCommand(Object command) {
try {
if (trace && TRACE_BYTES.isTraceEnabled()) {
TRACE_BYTES.trace("Received: \n" + command);
if (trace) {
TRACE_BYTES.trace("Received: \n{}", command);
}
protocolConverter.lock.lock();
try {
@ -113,8 +113,8 @@ public class AmqpTransportFilter extends TransportFilter implements AmqpTranspor
public void sendToAmqp(Object command) throws IOException {
assert protocolConverter.lock.isHeldByCurrentThread();
if (trace && TRACE_BYTES.isTraceEnabled()) {
TRACE_BYTES.trace("Sending: \n" + command);
if (trace) {
TRACE_BYTES.trace("Sending: \n{}", command);
}
Transport n = next;
if (n != null) {
@ -156,13 +156,10 @@ public class AmqpTransportFilter extends TransportFilter implements AmqpTranspor
return this.wireFormat;
}
public void handleException(IOException e) {
super.onException(e);
}
public String getTransformer() {
return transformer;
}

View File

@ -64,7 +64,7 @@ public class AMQ4563Test extends AmqpTestSupport {
message = session.createTextMessage();
String messageText = "Hello " + i + " sent at " + new java.util.Date().toString();
message.setText(messageText);
LOG.debug(">>>> Sent [" + messageText + "]");
LOG.debug(">>>> Sent [{}]", messageText);
p.send(message);
}
@ -97,7 +97,7 @@ public class AMQ4563Test extends AmqpTestSupport {
// Restart broker.
restartBroker(connection, session);
String selector = "JMSMessageID = '" + message.getJMSMessageID() + "'";
LOG.info("Using selector: "+selector);
LOG.info("Using selector: {}", selector);
int messagesReceived = readAllMessages(queue, selector);
assertEquals(1, messagesReceived);
}
@ -120,7 +120,7 @@ public class AMQ4563Test extends AmqpTestSupport {
// Restart broker.
restartBroker(connection, session);
String selector = "JMSMessageID = '" + message.getJMSMessageID() + "'";
LOG.info("Using selector: "+selector);
LOG.info("Using selector: {}", selector);
int messagesReceived = readAllMessages(queue, selector);
assertEquals(1, messagesReceived);
}
@ -140,7 +140,7 @@ public class AMQ4563Test extends AmqpTestSupport {
message = session.createTextMessage();
String messageText = "Hello " + i + " sent at " + new java.util.Date().toString();
message.setText(messageText);
LOG.debug(">>>> Sent [" + messageText + "]");
LOG.debug(">>>> Sent [{}]", messageText);
p.send(message);
}
@ -175,7 +175,7 @@ public class AMQ4563Test extends AmqpTestSupport {
assertNotNull(msg);
assertTrue(msg instanceof TextMessage);
TextMessage textMessage = (TextMessage) msg;
LOG.debug(">>>> Received [" + textMessage.getText() + "]");
LOG.debug(">>>> Received [{}]", textMessage.getText());
messagesReceived++;
msg = consumer.receive(5000);
}
@ -196,7 +196,7 @@ public class AMQ4563Test extends AmqpTestSupport {
}
private Connection createAMQPConnection() throws JMSException {
LOG.debug(">>> In createConnection using port " + port);
LOG.debug(">>> In createConnection using port {}", port);
final ConnectionFactoryImpl factory = new ConnectionFactoryImpl("localhost", port, "admin", "password");
final Connection connection = factory.createConnection();
connection.setExceptionListener(new ExceptionListener() {
@ -210,7 +210,7 @@ public class AMQ4563Test extends AmqpTestSupport {
}
private Connection createAMQConnection() throws JMSException {
LOG.debug(">>> In createConnection using port " + port);
LOG.debug(">>> In createConnection using port {}", port);
final ConnectionFactory factory = new ActiveMQConnectionFactory("admin", "password", openwireUri);
final Connection connection = factory.createConnection();
connection.setExceptionListener(new ExceptionListener() {

View File

@ -42,7 +42,7 @@ public class AMQ4696Test extends AmqpTestSupport {
BrokerView adminView = this.brokerService.getAdminView();
int durableSubscribersAtStart = adminView.getDurableTopicSubscribers().length;
int inactiveSubscribersAtStart = adminView.getInactiveDurableTopicSubscribers().length;
LOG.debug(">>>> At Start, durable Subscribers " + durableSubscribersAtStart + " inactiveDurableSubscribers " + inactiveSubscribersAtStart);
LOG.debug(">>>> At Start, durable Subscribers {} inactiveDurableSubscribers {}", durableSubscribersAtStart, inactiveSubscribersAtStart);
TopicConnectionFactory factory = new ConnectionFactoryImpl("localhost", port, "admin", "password");
Topic topic = new TopicImpl("topic://" + TOPIC_NAME);
@ -55,7 +55,7 @@ public class AMQ4696Test extends AmqpTestSupport {
int durableSubscribers = adminView.getDurableTopicSubscribers().length;
int inactiveSubscribers = adminView.getInactiveDurableTopicSubscribers().length;
LOG.debug(">>>> durable Subscribers after creation " + durableSubscribers + " inactiveDurableSubscribers " + inactiveSubscribers);
LOG.debug(">>>> durable Subscribers after creation {} inactiveDurableSubscribers {}", durableSubscribers, inactiveSubscribers);
assertEquals("Wrong number of durable subscribers after first subscription", 1, (durableSubscribers - durableSubscribersAtStart));
assertEquals("Wrong number of inactive durable subscribers after first subscription", 0, (inactiveSubscribers - inactiveSubscribersAtStart));
@ -64,7 +64,7 @@ public class AMQ4696Test extends AmqpTestSupport {
durableSubscribers = adminView.getDurableTopicSubscribers().length;
inactiveSubscribers = adminView.getInactiveDurableTopicSubscribers().length;
LOG.debug(">>>> durable Subscribers after close " + durableSubscribers + " inactiveDurableSubscribers " + inactiveSubscribers);
LOG.debug(">>>> durable Subscribers after close {} inactiveDurableSubscribers {}", durableSubscribers, inactiveSubscribers);
assertEquals("Wrong number of durable subscribers after close", 0, (durableSubscribersAtStart));
assertEquals("Wrong number of inactive durable subscribers after close", 1, (inactiveSubscribers - inactiveSubscribersAtStart));
}

View File

@ -42,9 +42,6 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
*/
public class AmqpTransformerTest {
private static final Logger LOG = LoggerFactory.getLogger(AmqpTransformerTest.class);
@ -135,7 +132,7 @@ public class AmqpTransformerTest {
Message message = c.receive(2000);
assertNotNull("Should have received a message", message);
LOG.info("Recieved message: ", message);
LOG.info("Recieved message: {}", message);
assertTrue(message instanceof BytesMessage);
Boolean nativeTransformationUsed = message.getBooleanProperty("JMS_AMQP_NATIVE");
Long messageFormat = message.getLongProperty("JMS_AMQP_MESSAGE_FORMAT");

View File

@ -42,9 +42,6 @@ import org.junit.Test;
import org.junit.rules.TestName;
import org.objectweb.jtests.jms.framework.TestConfig;
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
public class JMSClientTest extends AmqpTestSupport {
@Rule public TestName name = new TestName();

View File

@ -160,7 +160,7 @@ public class SimpleAMQPAuthTest {
}
protected BrokerService createBroker(String uri) throws Exception {
LOG.debug(">>>>> Loading broker configuration from the classpath with URI: " + uri);
LOG.debug(">>>>> Loading broker configuration from the classpath with URI: {}", uri);
return BrokerFactory.createBroker(new URI("xbean:" + uri));
}

View File

@ -16,9 +16,6 @@
*/
package org.apache.activemq.transport.amqp.joram;
/**
* @author Kevin Earls
*/
public class ActiveMQNIOAdmin extends ActiveMQAdmin {
private static final String AMQP_NIO_URI = "amqp+nio://localhost:0";

View File

@ -68,7 +68,7 @@ public class ActiveMQSSLAdmin extends ActiveMQAdmin {
String connectorURI = getConnectorURI();
TransportConnector connector = broker.addConnector(connectorURI);
port = connector.getConnectUri().getPort();
LOG.info("ssl port is " + port);
LOG.info("ssl port is {}", port);
broker.start();
//broker.
@ -83,7 +83,7 @@ public class ActiveMQSSLAdmin extends ActiveMQAdmin {
@Override
public void createConnectionFactory(String name) {
try {
LOG.debug("Creating a connection factory using port " + port);
LOG.debug("Creating a connection factory using port {}", port);
final ConnectionFactory factory = new ConnectionFactoryImpl("localhost", port, null, null, null, true);
context.bind(name, factory);
} catch (NamingException e) {

View File

@ -38,9 +38,6 @@ import org.objectweb.jtests.jms.conform.session.SessionTest;
import org.objectweb.jtests.jms.conform.session.UnifiedSessionTest;
import org.objectweb.jtests.jms.conform.topic.TemporaryTopicTest;
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
public class JoramJmsTest extends TestCase {
public static Test suite() {

View File

@ -512,10 +512,8 @@ public class AdvisoryBroker extends BrokerFilter {
}
private void handleFireFailure(String message, Throwable cause) {
LOG.warn("Failed to fire " + message + " advisory, reason: " + cause);
if (LOG.isDebugEnabled()) {
LOG.debug(message + " detail", cause);
}
LOG.warn("Failed to fire {} advisory, reason: {}", message, cause);
LOG.debug("{} detail: {}", message, cause);
}
protected void fireAdvisory(ConnectionContext context, ActiveMQTopic topic, Command command) throws Exception {

View File

@ -38,13 +38,13 @@ public abstract class BrokerPluginSupport extends MutableBrokerFilter implements
@Override
public void start() throws Exception {
super.start();
LOG.info("Broker Plugin " + getClass().getName() + " started");
LOG.info("Broker Plugin {} started", getClass().getName());
}
@Override
public void stop() throws Exception {
super.stop();
LOG.info("Broker Plugin " + getClass().getName() + " stopped");
LOG.info("Broker Plugin {} stopped", getClass().getName());
}
}

View File

@ -49,7 +49,7 @@ public class BrokerRegistry {
if (result == null && brokerName != null && brokerName.equals(BrokerService.DEFAULT_BROKER_NAME)) {
result = findFirst();
if (result != null) {
LOG.warn("Broker localhost not started so using " + result.getBrokerName() + " instead");
LOG.warn("Broker localhost not started so using {} instead", result.getBrokerName());
}
}
if (result == null && (brokerName==null || brokerName.isEmpty() || brokerName.equals("null"))){

View File

@ -568,7 +568,7 @@ public class BrokerService implements Service {
startBroker(startAsync);
brokerRegistry.bind(getBrokerName(), BrokerService.this);
} catch (Exception e) {
LOG.error("Failed to start Apache ActiveMQ (" + getBrokerName() + ", " + brokerId + "). Reason: " + e, e);
LOG.error("Failed to start Apache ActiveMQ ({}, {})", new Object[]{ getBrokerName(), brokerId }, e);
try {
if (!stopped.get()) {
stop();
@ -606,7 +606,7 @@ public class BrokerService implements Service {
private void doStartPersistenceAdapter() throws Exception {
getPersistenceAdapter().setUsageManager(getProducerSystemUsage());
getPersistenceAdapter().setBrokerName(getBrokerName());
LOG.info("Using Persistence Adapter: " + getPersistenceAdapter());
LOG.info("Using Persistence Adapter: {}", getPersistenceAdapter());
if (deleteAllMessagesOnStartup) {
deleteAllMessages();
}
@ -644,10 +644,7 @@ public class BrokerService implements Service {
brokerId = broker.getBrokerId();
// need to log this after creating the broker so we have its id and name
if (LOG.isInfoEnabled()) {
LOG.info("Apache ActiveMQ " + getBrokerVersion() + " ("
+ getBrokerName() + ", " + brokerId + ") is starting");
}
LOG.info("Apache ActiveMQ {} ({}, {}) is starting", new Object[]{ getBrokerVersion(), getBrokerName(), brokerId });
broker.start();
if (isUseJmx()) {
@ -668,11 +665,8 @@ public class BrokerService implements Service {
startAllConnectors();
if (LOG.isInfoEnabled()) {
LOG.info("Apache ActiveMQ " + getBrokerVersion() + " ("
+ getBrokerName() + ", " + brokerId + ") started");
LOG.info("Apache ActiveMQ {} ({}, {}) started", new Object[]{ getBrokerVersion(), getBrokerName(), brokerId});
LOG.info("For help or more information please see: http://activemq.apache.org");
}
getBroker().brokerServiceStarted();
checkSystemUsageLimits();
@ -717,10 +711,7 @@ public class BrokerService implements Service {
}.start();
}
if (LOG.isInfoEnabled()) {
LOG.info("Apache ActiveMQ " + getBrokerVersion() + " ("
+ getBrokerName() + ", " + brokerId + ") is shutting down");
}
LOG.info("Apache ActiveMQ {} ({}, {}) is shutting down", new Object[]{ getBrokerVersion(), getBrokerName(), brokerId} );
removeShutdownHook();
if (this.scheduler != null) {
@ -780,14 +771,10 @@ public class BrokerService implements Service {
this.destinationInterceptors = null;
this.destinationFactory = null;
if (LOG.isInfoEnabled()) {
if (startDate != null) {
LOG.info("Apache ActiveMQ " + getBrokerVersion() + " ("
+ getBrokerName() + ", " + brokerId + ") uptime " + getUptime());
}
LOG.info("Apache ActiveMQ " + getBrokerVersion() + " ("
+ getBrokerName() + ", " + brokerId + ") is shutdown");
LOG.info("Apache ActiveMQ {} ({}, {}) uptime {}", new Object[]{ getBrokerVersion(), getBrokerName(), brokerId, getUptime()});
}
LOG.info("Apache ActiveMQ {} ({}, {}) is shutdown", new Object[]{ getBrokerVersion(), getBrokerName(), brokerId});
synchronized (shutdownHooks) {
for (Runnable hook : shutdownHooks) {
@ -817,8 +804,7 @@ public class BrokerService implements Service {
queueSize = entry.getValue().getDestinationStatistics().getMessages().getCount();
count += queueSize;
if (queueSize > 0) {
LOG.info("Queue has pending message:" + entry.getValue().getName() + " queueSize is:"
+ queueSize);
LOG.info("Queue has pending message: {} queueSize is: {}", entry.getValue().getName(), queueSize);
}
}
}
@ -850,8 +836,9 @@ public class BrokerService implements Service {
if (pollInterval <= 0) {
pollInterval = 30;
}
LOG.info("Stop gracefully with connectorName:" + connectorName + " queueName:" + queueName + " timeout:"
+ timeout + " pollInterval:" + pollInterval);
LOG.info("Stop gracefully with connectorName: {} queueName: {} timeout: {} pollInterval: {}", new Object[]{
connectorName, queueName, timeout, pollInterval
});
TransportConnector connector;
for (int i = 0; i < transportConnectors.size(); i++) {
connector = transportConnectors.get(i);
@ -953,7 +940,7 @@ public class BrokerService implements Service {
}
String str = brokerName.replaceAll("[^a-zA-Z0-9\\.\\_\\-\\:]", "_");
if (!str.equals(brokerName)) {
LOG.error("Broker Name: " + brokerName + " contained illegal characters - replaced with " + str);
LOG.error("Broker Name: {} contained illegal characters - replaced with {}", brokerName, str);
}
this.brokerName = str.trim();
}
@ -1151,7 +1138,7 @@ public class BrokerService implements Service {
*/
public void setPersistenceAdapter(PersistenceAdapter persistenceAdapter) throws IOException {
if (!isPersistent() && ! (persistenceAdapter instanceof MemoryPersistenceAdapter)) {
LOG.warn("persistent=\"false\", ignoring configured persistenceAdapter: " + persistenceAdapter);
LOG.warn("persistent=\"false\", ignoring configured persistenceAdapter: {}", persistenceAdapter);
return;
}
this.persistenceAdapter = persistenceAdapter;
@ -1508,7 +1495,7 @@ public class BrokerService implements Service {
try {
vmConnectorURI = new URI("vm://" + getBrokerName().replaceAll("[^a-zA-Z0-9\\.\\_\\-]", "_"));
} catch (URISyntaxException e) {
LOG.error("Badly formed URI from " + getBrokerName(), e);
LOG.error("Badly formed URI from {}", getBrokerName(), e);
}
}
return vmConnectorURI;
@ -1526,7 +1513,7 @@ public class BrokerService implements Service {
try {
result = tc.getPublishableConnectString();
} catch (Exception e) {
LOG.warn("Failed to get the ConnectURI for "+tc,e);
LOG.warn("Failed to get the ConnectURI for {}", tc, e);
}
if (result != null) {
// find first publishable uri
@ -1657,7 +1644,7 @@ public class BrokerService implements Service {
}
if (!empty) {
String str = result ? "Successfully deleted" : "Failed to delete";
LOG.info(str + " temporary storage");
LOG.info("{} temporary storage", str);
}
String clazz = "org.apache.activemq.store.kahadb.plist.PListStoreImpl";
@ -1845,7 +1832,7 @@ public class BrokerService implements Service {
jobSchedulerStore.setDirectory(getSchedulerDirectoryFile());
configureService(jobSchedulerStore);
jobSchedulerStore.start();
LOG.info("JobScheduler using directory: " + getSchedulerDirectoryFile());
LOG.info("JobScheduler using directory: {}", getSchedulerDirectoryFile());
} catch (Exception e) {
throw new RuntimeException(e);
}
@ -2099,7 +2086,7 @@ public class BrokerService implements Service {
ObjectName objectName = createNetworkConnectorObjectName(connector);
getManagementContext().unregisterMBean(objectName);
} catch (Exception e) {
LOG.error("Network Connector could not be unregistered from JMX: " + e, e);
LOG.error("Network Connector could not be unregistered from JMX", e);
}
}
}
@ -2185,7 +2172,7 @@ public class BrokerService implements Service {
regionBroker = new ManagedRegionBroker(this, getManagementContext(), getBrokerObjectName(),
getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor());
} catch(MalformedObjectNameException me){
LOG.error("Couldn't create ManagedRegionBroker",me);
LOG.error("Couldn't create ManagedRegionBroker", me);
throw new IOException(me);
}
} else {
@ -2315,7 +2302,7 @@ public class BrokerService implements Service {
Object port = options.get("port");
if (port == null) {
port = DEFAULT_PORT;
LOG.warn("No port specified so defaulting to: " + port);
LOG.warn("No port specified so defaulting to: {}", port);
}
return port;
}
@ -2337,7 +2324,7 @@ public class BrokerService implements Service {
try {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
} catch (Exception e) {
LOG.debug("Caught exception, must be shutting down: " + e);
LOG.debug("Caught exception, must be shutting down", e);
}
}
}
@ -2470,10 +2457,10 @@ public class BrokerService implements Service {
@Override
public void run() {
try {
LOG.info("Async start of " + connector);
LOG.info("Async start of {}", connector);
connector.start();
} catch(Exception e) {
LOG.error("Async start of network connector: " + connector + " failed", e);
LOG.error("Async start of network connector: {} failed", connector, e);
}
}
});
@ -2538,7 +2525,7 @@ public class BrokerService implements Service {
if (ioExceptionHandler != null) {
ioExceptionHandler.handle(exception);
} else {
LOG.info("No IOExceptionHandler registered, ignoring IO exception, " + exception, exception);
LOG.info("No IOExceptionHandler registered, ignoring IO exception", exception);
}
}

View File

@ -19,8 +19,6 @@ package org.apache.activemq.broker;
/**
* This exception is thrown by the broker when you try to use it after it has
* been stopped.
*
* @author chirino
*/
public class BrokerStoppedException extends IllegalStateException {

View File

@ -122,7 +122,7 @@ public abstract class LockableServiceSupport extends ServiceSupport implements L
}
}
} catch (IOException e) {
LOG.warn("locker keepAlive resulted in: " + e, e);
LOG.warn("locker keepAlive resulted in", e);
}
if (stop) {
stopBroker();
@ -131,7 +131,7 @@ public abstract class LockableServiceSupport extends ServiceSupport implements L
protected void stopBroker() {
// we can no longer keep the lock so lets fail
LOG.error(brokerService.getBrokerName() + ", no longer able to keep the exclusive lock so giving up being a master");
LOG.error("{}, no longer able to keep the exclusive lock so giving up being a master", brokerService.getBrokerName());
try {
if( brokerService.isRestartAllowed() ) {
brokerService.requestRestart();

View File

@ -143,17 +143,15 @@ public class ProducerBrokerExchange {
long lastStoredForMessageProducer = getStoredSequenceIdForMessage(messageSend.getMessageId());
if (producerSequenceId <= lastStoredForMessageProducer) {
canDispatch = false;
if (LOG.isDebugEnabled()) {
LOG.debug("suppressing duplicate message send [" + (LOG.isTraceEnabled() ? messageSend : messageSend.getMessageId()) + "] from network producer with producerSequenceId ["
+ producerSequenceId + "] less than last stored: " + lastStoredForMessageProducer);
}
LOG.debug("suppressing duplicate message send [{}] from network producer with producerSequence [{}] less than last stored: {}", new Object[]{
(LOG.isTraceEnabled() ? messageSend : messageSend.getMessageId()), producerSequenceId, lastStoredForMessageProducer
});
}
} else if (producerSequenceId <= lastSendSequenceNumber.get()) {
canDispatch = false;
if (LOG.isDebugEnabled()) {
LOG.debug("suppressing duplicate message send [" + (LOG.isTraceEnabled() ? messageSend : messageSend.getMessageId()) + "] with producerSequenceId ["
+ producerSequenceId + "] less than last stored: " + lastSendSequenceNumber);
}
LOG.debug("suppressing duplicated message send [{}] with producerSequenceId [{}] less than last stored: {}", new Object[]{
(LOG.isTraceEnabled() ? messageSend : messageSend.getMessageId()), producerSequenceId, lastSendSequenceNumber
});
} else {
// track current so we can suppress duplicates later in the stream
lastSendSequenceNumber.set(producerSequenceId);
@ -166,7 +164,7 @@ public class ProducerBrokerExchange {
try {
return brokerService.getPersistenceAdapter().getLastProducerSequenceId(messageId.getProducerId());
} catch (IOException ignored) {
LOG.debug("Failed to determine last producer sequence id for: " + messageId, ignored);
LOG.debug("Failed to determine last producer sequence id for: {}", messageId, ignored);
}
return -1;
}
@ -178,7 +176,7 @@ public class ProducerBrokerExchange {
isNetworkProducer = true;
}
lastSendSequenceNumber.set(l);
LOG.debug("last stored sequence id set: " + l);
LOG.debug("last stored sequence id set: {}", l);
}
public void incrementSend() {

View File

@ -25,7 +25,6 @@ import java.security.SecureRandom;
import javax.net.ssl.KeyManager;
import javax.net.ssl.TrustManager;
import org.apache.activemq.transport.TransportFactory;
import org.apache.activemq.transport.TransportFactorySupport;
import org.apache.activemq.transport.TransportServer;
import org.apache.activemq.transport.tcp.SslTransportFactory;

View File

@ -107,9 +107,7 @@ public class TransactionBroker extends BrokerFilter {
}
transaction.setState(Transaction.PREPARED_STATE);
registerMBean(transaction);
if (LOG.isDebugEnabled()) {
LOG.debug("recovered prepared transaction: " + transaction.getTransactionId());
}
LOG.debug("recovered prepared transaction: {}", transaction.getTransactionId());
} catch (Throwable e) {
throw new WrappedException(e);
}
@ -177,9 +175,7 @@ public class TransactionBroker extends BrokerFilter {
public void afterRollback() throws Exception {
if (!messageSend) {
destination.clearPendingMessages();
if (LOG.isDebugEnabled()) {
LOG.debug("cleared pending from afterRollback : " + destination);
}
LOG.debug("cleared pending from afterRollback: {}", destination);
}
}
@ -189,9 +185,7 @@ public class TransactionBroker extends BrokerFilter {
destination.clearPendingMessages();
destination.getDestinationStatistics().getEnqueues().add(opCount);
destination.getDestinationStatistics().getMessages().add(opCount);
if (LOG.isDebugEnabled()) {
LOG.debug("cleared pending from afterCommit : " + destination);
}
LOG.debug("cleared pending from afterCommit: {}", destination);
} else {
destination.getDestinationStatistics().getDequeues().add(opCount);
destination.getDestinationStatistics().getMessages().subtract(opCount);
@ -215,18 +209,14 @@ public class TransactionBroker extends BrokerFilter {
for (Iterator<XATransaction> iter = xaTransactions.values().iterator(); iter.hasNext();) {
Transaction tx = iter.next();
if (tx.isPrepared()) {
if (LOG.isDebugEnabled()) {
LOG.debug("prepared transaction: " + tx.getTransactionId());
}
LOG.debug("prepared transaction: {}", tx.getTransactionId());
txs.add(tx.getTransactionId());
}
}
}
XATransactionId rc[] = new XATransactionId[txs.size()];
txs.toArray(rc);
if (LOG.isDebugEnabled()) {
LOG.debug("prepared transaction list size: " + rc.length);
}
LOG.debug("prepared transaction list size: {}", rc.length);
return rc;
}
@ -322,9 +312,7 @@ public class TransactionBroker extends BrokerFilter {
if (sync != null && transaction != null) {
transaction.removeSynchronization(sync);
}
if (LOG.isDebugEnabled()) {
LOG.debug("IGNORING duplicate message " + message);
}
LOG.debug("IGNORING duplicate message {}", message);
}
}

View File

@ -185,7 +185,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
if (bService.isShutdownOnSlaveFailure()) {
if (brokerInfo != null) {
if (brokerInfo.isSlaveBroker()) {
LOG.error("Slave has exception: " + e.getMessage() + " shutting down master now.", e);
LOG.error("Slave has exception: {} shutting down master now.", e.getMessage(), e);
try {
doStop();
bService.stop();
@ -247,9 +247,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
// Handle the case where the broker is stopped
// But the client is still connected.
if (!stopping.get()) {
if (SERVICELOG.isDebugEnabled()) {
SERVICELOG.debug("Broker has been stopped. Notifying client and closing his connection.");
}
ConnectionError ce = new ConnectionError();
ce.setException(e);
dispatchSync(ce);
@ -269,7 +267,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
} else if (!stopping.get() && !inServiceException) {
inServiceException = true;
try {
SERVICELOG.warn("Async error occurred: " + e, e);
SERVICELOG.warn("Async error occurred: ", e);
ConnectionError ce = new ConnectionError();
ce.setException(e);
if (pendingStop) {
@ -659,14 +657,14 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
try {
processRemoveConsumer(consumerId, lastDeliveredSequenceId);
} catch (Throwable e) {
LOG.warn("Failed to remove consumer: " + consumerId + ". Reason: " + e, e);
LOG.warn("Failed to remove consumer: {}", consumerId, e);
}
}
for (ProducerId producerId : session.getProducerIds()) {
try {
processRemoveProducer(producerId);
} catch (Throwable e) {
LOG.warn("Failed to remove producer: " + producerId + ". Reason: " + e, e);
LOG.warn("Failed to remove producer: {}", producerId, e);
}
}
cs.removeSession(id);
@ -697,16 +695,15 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
// to figure out the winner.
synchronized (state.getConnectionMutex()) {
if (state.getConnection() != this) {
LOG.debug("Killing previous stale connection: " + state.getConnection().getRemoteAddress());
LOG.debug("Killing previous stale connection: {}", state.getConnection().getRemoteAddress());
state.getConnection().stop();
LOG.debug("Connection " + getRemoteAddress() + " taking over previous connection: "
+ state.getConnection().getRemoteAddress());
LOG.debug("Connection {} taking over previous connection: {}", getRemoteAddress(), state.getConnection().getRemoteAddress());
state.setConnection(this);
state.reset(info);
}
}
registerConnectionState(info.getConnectionId(), state);
LOG.debug("Setting up new connection id: " + info.getConnectionId() + ", address: " + getRemoteAddress() + ", info: " + info);
LOG.debug("Setting up new connection id: {}, address: {}, info: {}", new Object[]{ info.getConnectionId(), getRemoteAddress(), info });
this.faultTolerantConnection = info.isFaultTolerant();
// Setup the context.
String clientId = info.getClientId();
@ -739,10 +736,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
brokerConnectionStates.remove(info.getConnectionId());
}
unregisterConnectionState(info.getConnectionId());
LOG.warn("Failed to add Connection " + info.getConnectionId() + ", reason: " + e.toString());
if (LOG.isDebugEnabled()) {
LOG.debug("Exception detail:", e);
}
LOG.warn("Failed to add Connection {}", info.getConnectionId(), e);
if (e instanceof SecurityException) {
// close this down - in case the peer of this transport doesn't play nice
delayedStop(2000, "Failed with SecurityException: " + e.getLocalizedMessage(), e);
@ -764,7 +758,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
@Override
public synchronized Response processRemoveConnection(ConnectionId id, long lastDeliveredSequenceId)
throws InterruptedException {
LOG.debug("remove connection id: " + id);
LOG.debug("remove connection id: {}", id);
TransportConnectionState cs = lookupConnectionState(id);
if (cs != null) {
// Don't allow things to be added to the connection state while we
@ -775,7 +769,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
try {
processRemoveSession(sessionId, lastDeliveredSequenceId);
} catch (Throwable e) {
SERVICELOG.warn("Failed to remove session " + sessionId, e);
SERVICELOG.warn("Failed to remove session {}", sessionId, e);
}
}
// Cascade the connection stop to temp destinations.
@ -784,17 +778,14 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
try {
broker.removeDestination(cs.getContext(), di.getDestination(), 0);
} catch (Throwable e) {
SERVICELOG.warn("Failed to remove tmp destination " + di.getDestination(), e);
SERVICELOG.warn("Failed to remove tmp destination {}", di.getDestination(), e);
}
iter.remove();
}
try {
broker.removeConnection(cs.getContext(), cs.getInfo(), null);
} catch (Throwable e) {
SERVICELOG.warn("Failed to remove connection " + cs.getInfo() + ", reason: " + e.toString());
if (LOG.isDebugEnabled()) {
SERVICELOG.debug("Exception detail:", e);
}
SERVICELOG.warn("Failed to remove connection {}", cs.getInfo(), e);
}
TransportConnectionState state = unregisterConnectionState(id);
if (state != null) {
@ -977,7 +968,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
// stop() runs, so queue the stop until right now:
setStarting(false);
if (isPendingStop()) {
LOG.debug("Calling the delayed stop() after start() " + this);
LOG.debug("Calling the delayed stop() after start() {}", this);
stop();
}
}
@ -990,7 +981,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
stopAsync();
while (!stopped.await(5, TimeUnit.SECONDS)) {
LOG.info("The connection to '" + transport.getRemoteAddress() + "' is taking a long time to shutdown.");
LOG.info("The connection to '{}' is taking a long time to shutdown.", transport.getRemoteAddress());
}
}
@ -1007,7 +998,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
try {
Thread.sleep(waitTime);
stopAsync();
LOG.info("Stopping " + transport.getRemoteAddress() + " because " + reason);
LOG.info("Stopping {} because {}", transport.getRemoteAddress(), reason);
} catch (InterruptedException e) {
}
}
@ -1045,7 +1036,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
try {
doStop();
} catch (Throwable e) {
LOG.debug("Error occurred while shutting down a connection " + this, e);
LOG.debug("Error occurred while shutting down a connection {}", this, e);
} finally {
stopped.countDown();
serviceLock.writeLock().unlock();
@ -1078,9 +1069,9 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
}
try {
transport.stop();
LOG.debug("Stopped transport: " + transport.getRemoteAddress());
LOG.debug("Stopped transport: {}", transport.getRemoteAddress());
} catch (Exception e) {
LOG.debug("Could not stop transport to " + transport.getRemoteAddress() + ". This exception is ignored.", e);
LOG.debug("Could not stop transport to {}. This exception is ignored.", transport.getRemoteAddress(), e);
}
if (taskRunner != null) {
taskRunner.shutdown(1);
@ -1265,7 +1256,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
@Override
public Response processBrokerInfo(BrokerInfo info) {
if (info.isSlaveBroker()) {
LOG.error(" Slave Brokers are no longer supported - slave trying to attach is: " + info.getBrokerName());
LOG.error(" Slave Brokers are no longer supported - slave trying to attach is: {}", info.getBrokerName());
} else if (info.isNetworkConnection() && info.isDuplexConnection()) {
// so this TransportConnection is the rear end of a network bridge
// We have been requested to create a two way pipe ...
@ -1288,7 +1279,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
for (Iterator<TransportConnection> iter = connections.iterator(); iter.hasNext(); ) {
TransportConnection c = iter.next();
if ((c != this) && (duplexNetworkConnectorId.equals(c.getDuplexNetworkConnectorId()))) {
LOG.warn("Stopping an existing active duplex connection [" + c + "] for network connector (" + duplexNetworkConnectorId + ").");
LOG.warn("Stopping an existing active duplex connection [{}] for network connector ({}).", c, duplexNetworkConnectorId);
c.stopAsync();
// better to wait for a bit rather than get connection id already in use and failure to start new bridge
c.getStopped().await(1, TimeUnit.SECONDS);
@ -1314,19 +1305,19 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
info.setDuplexConnection(false);
duplexBridge.setCreatedByDuplex(true);
duplexBridge.duplexStart(this, brokerInfo, info);
LOG.info("Started responder end of duplex bridge " + duplexNetworkConnectorId);
LOG.info("Started responder end of duplex bridge {}", duplexNetworkConnectorId);
return null;
} catch (TransportDisposedIOException e) {
LOG.warn("Duplex bridge " + duplexNetworkConnectorId + " was stopped before it was correctly started.");
LOG.warn("Duplex bridge {} was stopped before it was correctly started.", duplexNetworkConnectorId);
return null;
} catch (Exception e) {
LOG.error("Failed to create responder end of duplex network bridge " + duplexNetworkConnectorId, e);
LOG.error("Failed to create responder end of duplex network bridge {}", duplexNetworkConnectorId, e);
return null;
}
}
// We only expect to get one broker info command per connection
if (this.brokerInfo != null) {
LOG.warn("Unexpected extra broker info command received: " + info);
LOG.warn("Unexpected extra broker info command received: {}", info);
}
this.brokerInfo = info;
networkConnection = true;

View File

@ -252,14 +252,12 @@ public class TransportConnector implements Connector, BrokerServiceAware {
this.statusDector.start();
}
LOG.info("Connector " + getName() + " Started");
LOG.info("Connector {} Started", getName());
}
public String getPublishableConnectString() throws Exception {
String publishableConnectString = publishedAddressPolicy.getPublishableConnectString(this);
if (LOG.isDebugEnabled()) {
LOG.debug("Publishing: " + publishableConnectString + " for broker transport URI: " + getConnectUri());
}
LOG.debug("Publishing: {} for broker transport URI: {}", publishableConnectString, getConnectUri());
return publishableConnectString;
}
@ -285,7 +283,7 @@ public class TransportConnector implements Connector, BrokerServiceAware {
}
server = null;
ss.throwFirstException();
LOG.info("Connector " + getName() + " Stopped");
LOG.info("Connector {} Stopped", getName());
}
// Implementation methods

View File

@ -86,11 +86,11 @@ public class TransportStatusDetector implements Service, Runnable {
}
protected void doCollection(TransportConnection tc) {
LOG.warn("found a blocked client - stopping: " + tc);
LOG.warn("found a blocked client - stopping: {}", tc);
try {
tc.stop();
} catch (Exception e) {
LOG.error("Error stopping " + tc, e);
LOG.error("Error stopping {}", tc, e);
}
}

View File

@ -71,7 +71,7 @@ public class ConnectionSplitBroker extends BrokerFilter{
for (ConsumerInfo nc : gcList) {
networkConsumerList.remove(nc);
super.removeConsumer(context, nc);
LOG.warn("Removed stale network consumer " + nc);
LOG.warn("Removed stale network consumer {}", nc);
}
}
}

View File

@ -80,10 +80,10 @@ public class AbortSlowConsumerStrategyView implements AbortSlowConsumerStrategyV
public void abortConsumer(ObjectName consumerToAbort) {
Subscription sub = broker.getSubscriber(consumerToAbort);
if (sub != null) {
LOG.info("aborting consumer via jmx: " + sub.getConsumerInfo().getConsumerId());
LOG.info("aborting consumer via jmx: {}", sub.getConsumerInfo().getConsumerId());
strategy.abortConsumer(sub, false);
} else {
LOG.warn("cannot resolve subscription matching name: " + consumerToAbort);
LOG.warn("cannot resolve subscription matching name: {}", consumerToAbort);
}
}
@ -91,10 +91,10 @@ public class AbortSlowConsumerStrategyView implements AbortSlowConsumerStrategyV
public void abortConnection(ObjectName consumerToAbort) {
Subscription sub = broker.getSubscriber(consumerToAbort);
if (sub != null) {
LOG.info("aborting consumer connection via jmx: " + sub.getConsumerInfo().getConsumerId().getConnectionId());
LOG.info("aborting consumer connection via jmx: {}", sub.getConsumerInfo().getConsumerId().getConnectionId());
strategy.abortConsumer(sub, true);
} else {
LOG.warn("cannot resolve subscription matching name: " + consumerToAbort);
LOG.warn("cannot resolve subscription matching name: {}", consumerToAbort);
}
}
@ -111,7 +111,7 @@ public class AbortSlowConsumerStrategyView implements AbortSlowConsumerStrategyV
try {
result = new ObjectName(objectName);
} catch (Exception e) {
LOG.warn("cannot create subscription ObjectName to abort, from string: " + objectName);
LOG.warn("cannot create subscription ObjectName to abort, from string: {}", objectName);
}
return result;
}

View File

@ -94,7 +94,7 @@ public class BrokerView implements BrokerViewMBean {
try {
brokerService.getPersistenceAdapter().checkpoint(true);
} catch (IOException e) {
LOG.error("Failed to checkpoint persistence adapter on gc request, reason:" + e, e);
LOG.error("Failed to checkpoint persistence adapter on gc request", e);
}
}

View File

@ -131,7 +131,7 @@ public class ManagedRegionBroker extends RegionBroker {
try {
managementContext.unregisterMBean(name);
} catch (InstanceNotFoundException e) {
LOG.warn("The MBean: " + name + " is no longer registered with JMX");
LOG.warn("The MBean {} is no longer registered with JMX", name);
} catch (Exception e) {
stopper.onException(this, e);
}
@ -170,13 +170,13 @@ public class ManagedRegionBroker extends RegionBroker {
view = new TopicView(this, (Topic)destination);
} else {
view = null;
LOG.warn("JMX View is not supported for custom destination: " + destination);
LOG.warn("JMX View is not supported for custom destination {}", destination);
}
if (view != null) {
registerDestination(objectName, destName, view);
}
} catch (Exception e) {
LOG.error("Failed to register destination " + destName, e);
LOG.error("Failed to register destination {}", destName, e);
}
}
@ -185,7 +185,7 @@ public class ManagedRegionBroker extends RegionBroker {
ObjectName objectName = BrokerMBeanSupport.createDestinationName(brokerObjectName, destName);
unregisterDestination(objectName);
} catch (Exception e) {
LOG.error("Failed to unregister " + destName, e);
LOG.error("Failed to unregister {}", destName, e);
}
}
@ -220,7 +220,7 @@ public class ManagedRegionBroker extends RegionBroker {
subscriptionMap.put(sub, objectName);
return objectName;
} catch (Exception e) {
LOG.error("Failed to register subscription " + sub, e);
LOG.error("Failed to register subscription {}", sub, e);
return null;
}
}
@ -294,7 +294,7 @@ public class ManagedRegionBroker extends RegionBroker {
managementContext.unregisterMBean(inactiveName);
}
} catch (Exception e) {
LOG.error("Failed to unregister subscription " + sub, e);
LOG.error("Failed to unregister subscription {}", sub, e);
}
}
}
@ -317,8 +317,8 @@ public class ManagedRegionBroker extends RegionBroker {
AsyncAnnotatedMBean.registerMBean(asyncInvokeService, mbeanTimeout, managementContext, view, key);
registeredMBeans.add(key);
} catch (Throwable e) {
LOG.warn("Failed to register MBean: " + key);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to register MBean {}", key);
LOG.debug("Failure reason: ", e);
}
}
@ -332,8 +332,8 @@ public class ManagedRegionBroker extends RegionBroker {
try {
managementContext.unregisterMBean(key);
} catch (Throwable e) {
LOG.warn("Failed to unregister MBean: " + key);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to unregister MBean {}", key);
LOG.debug("Failure reason: ", e);
}
}
if (view != null) {
@ -342,8 +342,8 @@ public class ManagedRegionBroker extends RegionBroker {
try {
managementContext.unregisterMBean(key);
} catch (Throwable e) {
LOG.warn("Failed to unregister slow consumer strategy MBean: " + key);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to unregister slow consumer strategy MBean {}", key);
LOG.debug("Failure reason: ", e);
}
}
}
@ -373,8 +373,8 @@ public class ManagedRegionBroker extends RegionBroker {
AsyncAnnotatedMBean.registerMBean(asyncInvokeService, mbeanTimeout, managementContext, view, key);
registeredMBeans.add(key);
} catch (Throwable e) {
LOG.warn("Failed to register MBean: " + key);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to register MBean {}", key);
LOG.debug("Failure reason: ", e);
}
}
@ -388,8 +388,8 @@ public class ManagedRegionBroker extends RegionBroker {
try {
managementContext.unregisterMBean(key);
} catch (Throwable e) {
LOG.warn("Failed to unregister MBean: " + key);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to unregister MBean {}", key);
LOG.debug("Failure reason: ", e);
}
}
}
@ -425,7 +425,7 @@ public class ManagedRegionBroker extends RegionBroker {
managementContext.unregisterMBean(inactiveName);
}
} catch (Throwable e) {
LOG.error("Unable to unregister inactive durable subscriber: " + subscriptionKey, e);
LOG.error("Unable to unregister inactive durable subscriber {}", subscriptionKey, e);
}
} else {
topicSubscribers.put(key, view);
@ -437,8 +437,8 @@ public class ManagedRegionBroker extends RegionBroker {
AsyncAnnotatedMBean.registerMBean(asyncInvokeService, mbeanTimeout, managementContext, view, key);
registeredMBeans.add(key);
} catch (Throwable e) {
LOG.warn("Failed to register MBean: " + key);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to register MBean {}", key);
LOG.debug("Failure reason: ", e);
}
}
@ -452,8 +452,8 @@ public class ManagedRegionBroker extends RegionBroker {
try {
managementContext.unregisterMBean(key);
} catch (Throwable e) {
LOG.warn("Failed to unregister MBean: " + key);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to unregister MBean {}", key);
LOG.debug("Failure reason: ", e);
}
}
DurableSubscriptionView view = (DurableSubscriptionView)durableTopicSubscribers.remove(key);
@ -483,7 +483,7 @@ public class ManagedRegionBroker extends RegionBroker {
SubscriptionInfo info = infos[i];
SubscriptionKey key = new SubscriptionKey(info);
if (!alreadyKnown(key)) {
LOG.debug("Restoring durable subscription mbean: " + info);
LOG.debug("Restoring durable subscription MBean {}", info);
subscriptions.put(key, info);
}
}
@ -500,9 +500,7 @@ public class ManagedRegionBroker extends RegionBroker {
private boolean alreadyKnown(SubscriptionKey key) {
boolean known = false;
known = ((TopicRegion) getTopicRegion()).durableSubscriptionExists(key);
if (LOG.isTraceEnabled()) {
LOG.trace("Sub with key: " + key + ", " + (known ? "": "not") + " already registered");
}
LOG.trace("Sub with key: {}, {} already registered", key, (known ? "": "not"));
return known;
}
@ -516,14 +514,14 @@ public class ManagedRegionBroker extends RegionBroker {
AsyncAnnotatedMBean.registerMBean(asyncInvokeService, mbeanTimeout, managementContext, view, objectName);
registeredMBeans.add(objectName);
} catch (Throwable e) {
LOG.warn("Failed to register MBean: " + key);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to register MBean {}", key);
LOG.debug("Failure reason: ", e);
}
inactiveDurableTopicSubscribers.put(objectName, view);
subscriptionKeys.put(key, objectName);
} catch (Exception e) {
LOG.error("Failed to register subscription " + info, e);
LOG.error("Failed to register subscription {}", info, e);
}
}
@ -534,7 +532,7 @@ public class ManagedRegionBroker extends RegionBroker {
try {
c[i] = OpenTypeSupport.convert(messages.get(i));
} catch (Throwable e) {
LOG.error("failed to browse : " + view, e);
LOG.error("Failed to browse: {}", view, e);
}
}
return c;
@ -585,7 +583,7 @@ public class ManagedRegionBroker extends RegionBroker {
}
});
} catch (Throwable e) {
LOG.error("Failed to browse messages for Subscription " + view, e);
LOG.error("Failed to browse messages for Subscription {}", view, e);
}
return result;
@ -691,8 +689,8 @@ public class ManagedRegionBroker extends RegionBroker {
registeredMBeans.add(objectName);
}
} catch (Exception e) {
LOG.warn("Failed to register MBean: " + strategy);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to register MBean {}", strategy);
LOG.debug("Failure reason: ", e);
}
return objectName;
}
@ -706,8 +704,8 @@ public class ManagedRegionBroker extends RegionBroker {
registeredMBeans.add(objectName);
}
} catch (Exception e) {
LOG.warn("Failed to register prepared transaction MBean: " + transaction);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to register prepared transaction MBean {}", transaction);
LOG.debug("Failure reason: ", e);
}
}
@ -718,12 +716,12 @@ public class ManagedRegionBroker extends RegionBroker {
try {
managementContext.unregisterMBean(objectName);
} catch (Throwable e) {
LOG.warn("Failed to unregister MBean: " + objectName);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to unregister MBean {}", objectName);
LOG.debug("Failure reason: ", e);
}
}
} catch (Exception e) {
LOG.warn("Failed to create object name to unregister " + transaction, e);
LOG.warn("Failed to create object name to unregister {}", transaction, e);
}
}

View File

@ -19,7 +19,6 @@ package org.apache.activemq.broker.jmx;
import javax.jms.JMSException;
import javax.management.ObjectName;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.broker.region.Destination;
import org.apache.activemq.broker.region.DestinationFactory;

View File

@ -97,8 +97,8 @@ public class ManagedTransportConnection extends TransportConnection {
try {
AnnotatedMBean.registerMBean(managementContext, mbean, name);
} catch (Throwable e) {
LOG.warn("Failed to register MBean: " + name);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to register MBean {}", name);
LOG.debug("Failure reason: ", e);
}
}
}
@ -108,8 +108,8 @@ public class ManagedTransportConnection extends TransportConnection {
try {
managementContext.unregisterMBean(name);
} catch (Throwable e) {
LOG.warn("Failed to unregister mbean: " + name);
LOG.debug("Failure reason: " + e, e);
LOG.warn("Failed to unregister MBean {}", name);
LOG.debug("Failure reason: ", e);
}
}
}

View File

@ -110,7 +110,7 @@ public class ManagementContext implements Service {
getMBeanServer().invoke(namingServiceObjectName, "start", null, null);
}
} catch (Throwable ignore) {
LOG.debug("Error invoking start on mbean " + namingServiceObjectName + ". This exception is ignored.", ignore);
LOG.debug("Error invoking start on MBean {}. This exception is ignored.", namingServiceObjectName, ignore);
}
Thread t = new Thread("JMX connector") {
@ -135,11 +135,11 @@ public class ManagementContext implements Service {
}
connectorStarting.set(false);
}
LOG.info("JMX consoles can connect to " + server.getAddress());
LOG.info("JMX consoles can connect to {}", server.getAddress());
}
} catch (IOException e) {
LOG.warn("Failed to start jmx connector: " + e.getMessage() + ". Will restart management to re-create jmx connector, trying to remedy this issue.");
LOG.debug("Reason for failed jmx connector start", e);
LOG.warn("Failed to start JMX connector {}. Will restart management to re-create JMX connector, trying to remedy this issue.", e.getMessage());
LOG.debug("Reason for failed JMX connector start", e);
} finally {
MDC.remove("activemq.broker");
}
@ -177,7 +177,7 @@ public class ManagementContext implements Service {
server.stop();
}
} catch (IOException e) {
LOG.warn("Failed to stop jmx connector: " + e.getMessage());
LOG.warn("Failed to stop jmx connector: {}", e.getMessage());
}
// stop naming service mbean
try {
@ -188,7 +188,7 @@ public class ManagementContext implements Service {
getMBeanServer().unregisterMBean(namingServiceObjectName);
}
} catch (Throwable ignore) {
LOG.warn("Error stopping and unregsitering mbean " + namingServiceObjectName + " due " + ignore.getMessage());
LOG.warn("Error stopping and unregsitering MBean {} due to {}", namingServiceObjectName, ignore.getMessage());
}
namingServiceObjectName = null;
}
@ -324,7 +324,7 @@ public class ManagementContext implements Service {
try {
result = new ObjectName(tmp);
} catch (MalformedObjectNameException e) {
LOG.error("Couldn't create ObjectName from: " + type + " , " + name);
LOG.error("Couldn't create ObjectName from: {}, {}", type, name);
}
return result;
}
@ -452,16 +452,16 @@ public class ManagementContext implements Service {
}
return (MBeanServer)answer;
} else {
LOG.warn("Could not cast: " + answer + " into an MBeanServer. There must be some classloader strangeness in town");
LOG.warn("Could not cast: {} into an MBeanServer. There must be some classloader strangeness in town", answer);
}
} else {
LOG.warn("Method getPlatformMBeanServer() does not appear visible on type: " + type.getName());
LOG.warn("Method getPlatformMBeanServer() does not appear visible on type: {}", type.getName());
}
} catch (Exception e) {
LOG.warn("Failed to call getPlatformMBeanServer() due to: " + e, e);
LOG.warn("Failed to call getPlatformMBeanServer() due to: ", e);
}
} else {
LOG.trace("Class not found: " + name + " so probably running on Java 1.4");
LOG.trace("Class not found: {} so probably running on Java 1.4", name);
}
return null;
}
@ -516,7 +516,7 @@ public class ManagementContext implements Service {
Attribute attr = new Attribute("Port", Integer.valueOf(connectorPort));
mbeanServer.setAttribute(namingServiceObjectName, attr);
} catch(ClassNotFoundException e) {
LOG.debug("Probably not using JRE 1.4: " + e.getLocalizedMessage());
LOG.debug("Probably not using JRE 1.4: {}", e.getLocalizedMessage());
} catch (Throwable e) {
LOG.debug("Failed to create local registry. This exception will be ignored.", e);
}

View File

@ -130,9 +130,7 @@ public abstract class AbstractRegion implements Region {
Destination dest = destinations.get(destination);
if (dest == null) {
if (destination.isTemporary() == false || createIfTemporary) {
if (LOG.isDebugEnabled()) {
LOG.debug(broker.getBrokerName() + " adding destination: " + destination);
}
LOG.debug("{} adding destination: {}", broker.getBrokerName(), destination);
dest = createDestination(context, destination);
// intercept if there is a valid interceptor defined
DestinationInterceptor destinationInterceptor = broker.getDestinationInterceptor();
@ -196,9 +194,7 @@ public abstract class AbstractRegion implements Region {
// dropping the subscription.
}
if (LOG.isDebugEnabled()) {
LOG.debug(broker.getBrokerName() + " removing destination: " + destination);
}
LOG.debug("{} removing destination: {}", broker.getBrokerName(), destination);
destinationsLock.writeLock().lock();
try {
@ -220,9 +216,7 @@ public abstract class AbstractRegion implements Region {
}
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Cannot remove a destination that doesn't exist: " + destination);
}
LOG.debug("Cannot remove a destination that doesn't exist: {}", destination);
}
} finally {
destinationsLock.writeLock().unlock();
@ -255,10 +249,7 @@ public abstract class AbstractRegion implements Region {
@SuppressWarnings("unchecked")
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug(broker.getBrokerName() + " adding consumer: " + info.getConsumerId() + " for destination: "
+ info.getDestination());
}
LOG.debug("{} adding consumer: {} for destination: {}", new Object[]{ broker.getBrokerName(), info.getConsumerId(), info.getDestination() });
ActiveMQDestination destination = info.getDestination();
if (destination != null && !destination.isPattern() && !destination.isComposite()) {
// lets auto-create the destination
@ -357,10 +348,7 @@ public abstract class AbstractRegion implements Region {
@SuppressWarnings("unchecked")
public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug(broker.getBrokerName() + " removing consumer: " + info.getConsumerId() + " for destination: "
+ info.getDestination());
}
LOG.debug("{} removing consumer: {} for destination: {}", new Object[]{ broker.getBrokerName(), info.getConsumerId(), info.getDestination() });
Subscription sub = subscriptions.remove(info.getConsumerId());
// The sub could be removed elsewhere - see ConnectionSplitBroker
@ -412,12 +400,10 @@ public abstract class AbstractRegion implements Region {
sub = subscriptions.get(ack.getConsumerId());
if (sub == null) {
if (!consumerExchange.getConnectionContext().isInRecoveryMode()) {
LOG.warn("Ack for non existent subscription, ack:" + ack);
LOG.warn("Ack for non existent subscription, ack: {}", ack);
throw new IllegalArgumentException("The subscription does not exist: " + ack.getConsumerId());
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Ack for non existent subscription in recovery, ack:" + ack);
}
LOG.debug("Ack for non existent subscription in recovery, ack: {}", ack);
return;
}
}
@ -582,14 +568,11 @@ public abstract class AbstractRegion implements Region {
entry.configurePrefetch(sub);
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("setting prefetch: " + control.getPrefetch() + ", on subscription: "
+ control.getConsumerId() + "; resulting value: " + sub.getConsumerInfo().getCurrentPrefetchSize());
}
LOG.debug("setting prefetch: {}, on subscription: {}; resulting value: {}", new Object[]{ control.getPrefetch(), control.getConsumerId(), sub.getConsumerInfo().getCurrentPrefetchSize()});
try {
lookup(consumerExchange.getConnectionContext(), control.getDestination(),false).wakeup();
} catch (Exception e) {
LOG.warn("failed to deliver post consumerControl dispatch-wakeup, to destination: " + control.getDestination(), e);
LOG.warn("failed to deliver post consumerControl dispatch-wakeup, to destination: {}", control.getDestination(), e);
}
}
}

View File

@ -101,7 +101,7 @@ public abstract class AbstractSubscription implements Subscription {
try {
return (selectorExpression == null || selectorExpression.matches(context)) && this.context.isAllowedToConsume(node);
} catch (JMSException e) {
LOG.info("Selector failed to evaluate: " + e.getMessage(), e);
LOG.info("Selector failed to evaluate: {}", e.getMessage(), e);
return false;
}
}

View File

@ -100,7 +100,7 @@ public abstract class AbstractTempRegion extends AbstractRegion {
dest.dispose(context);
dest.stop();
} catch (Exception e) {
LOG.warn("Failed to dispose of " + dest, e);
LOG.warn("Failed to dispose of {}", dest, e);
}
}
}
@ -111,7 +111,7 @@ public abstract class AbstractTempRegion extends AbstractRegion {
dest.dispose(context);
dest.stop();
} catch (Exception e) {
LOG.warn("Failed to dispose of " + dest, e);
LOG.warn("Failed to dispose of {}", dest, e);
}
}

View File

@ -612,12 +612,12 @@ public abstract class BaseDestination implements Destination {
protected final void waitForSpace(ConnectionContext context, ProducerBrokerExchange producerBrokerExchange, Usage<?> usage, int highWaterMark, String warning) throws IOException, InterruptedException, ResourceAllocationException {
if (!context.isNetworkConnection() && systemUsage.isSendFailIfNoSpace()) {
getLog().debug("sendFailIfNoSpace, forcing exception on send, usage: " + usage + ": " + warning);
getLog().debug("sendFailIfNoSpace, forcing exception on send, usage: {}: {}", usage, warning);
throw new ResourceAllocationException(warning);
}
if (!context.isNetworkConnection() && systemUsage.getSendFailIfNoSpaceAfterTimeout() != 0) {
if (!usage.waitForSpace(systemUsage.getSendFailIfNoSpaceAfterTimeout(), highWaterMark)) {
getLog().debug("sendFailIfNoSpaceAfterTimeout expired, forcing exception on send, usage: " + usage + ": " + warning);
getLog().debug("sendFailIfNoSpaceAfterTimeout expired, forcing exception on send, usage: {}: {}", usage, warning);
throw new ResourceAllocationException(warning);
}
} else {
@ -632,7 +632,7 @@ public abstract class BaseDestination implements Destination {
long now = System.currentTimeMillis();
if (now >= nextWarn) {
getLog().info("" + usage + ": " + warning + " (blocking for: " + (now - start) / 1000 + "s)");
getLog().info("{}: {} (blocking for: {}s)", new Object[]{ usage, warning, new Long(((now - start) / 1000))});
nextWarn = now + blockedProducerWarningInterval;
}
}

View File

@ -141,9 +141,7 @@ public class DurableTopicSubscription extends PrefetchSubscription implements Us
this.context = context;
this.info = info;
if (LOG.isDebugEnabled()) {
LOG.debug("Activating " + this);
}
LOG.debug("Activating {}", this);
if (!keepDurableSubsActive) {
for (Destination destination : durableDestinations.values()) {
Topic topic = (Topic) destination;
@ -186,9 +184,7 @@ public class DurableTopicSubscription extends PrefetchSubscription implements Us
}
public void deactivate(boolean keepDurableSubsActive) throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug("Deactivating keepActive=" + keepDurableSubsActive + ", " + this);
}
LOG.debug("Deactivating keepActive={}, {}", keepDurableSubsActive, this);
active.set(false);
offlineTimestamp.set(System.currentTimeMillis());
this.usageManager.getMemoryUsage().removeUsageListener(this);

View File

@ -30,7 +30,6 @@ import org.apache.activemq.broker.Broker;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.broker.region.cursors.PendingMessageCursor;
import org.apache.activemq.broker.region.cursors.VMPendingMessageCursor;
import org.apache.activemq.command.ActiveMQMessage;
import org.apache.activemq.command.ConsumerControl;
import org.apache.activemq.command.ConsumerInfo;
import org.apache.activemq.command.Message;
@ -200,13 +199,12 @@ public abstract class PrefetchSubscription extends AbstractSubscription {
if (!okForAckAsDispatchDone.await(0l, TimeUnit.MILLISECONDS)) {
// suppress unexpected ack exception in this expected case
LOG.warn("Ignoring ack received before dispatch; result of failover with an outstanding ack. Acked messages will be replayed if present on this broker. Ignored ack: " + ack);
LOG.warn("Ignoring ack received before dispatch; result of failover with an outstanding ack. Acked messages will be replayed if present on this broker. Ignored ack: {}", ack);
return;
}
if (LOG.isTraceEnabled()) {
LOG.trace("ack:" + ack);
}
LOG.trace("ack: {}", ack);
synchronized(dispatchLock) {
if (ack.isStandardAck()) {
// First check if the ack matches the dispatched. When using failover this might
@ -268,8 +266,7 @@ public abstract class PrefetchSubscription extends AbstractSubscription {
// this only happens after a reconnect - get an ack which is not
// valid
if (!callDispatchMatched) {
LOG.warn("Could not correlate acknowledgment with dispatched message: "
+ ack);
LOG.warn("Could not correlate acknowledgment with dispatched message: {}", ack);
}
} else if (ack.isIndividualAck()) {
// Message was delivered and acknowledge - but only delete the
@ -418,8 +415,7 @@ public abstract class PrefetchSubscription extends AbstractSubscription {
}
}
} else {
LOG.debug("Acknowledgment out of sync (Normally occurs when failover connection reconnects): "
+ ack);
LOG.debug("Acknowledgment out of sync (Normally occurs when failover connection reconnects): {}", ack);
}
}
@ -731,10 +727,7 @@ public abstract class PrefetchSubscription extends AbstractSubscription {
if (node != QueueMessageReference.NULL_MESSAGE) {
nodeDest.getDestinationStatistics().getDispatched().increment();
nodeDest.getDestinationStatistics().getInflight().increment();
if (LOG.isTraceEnabled()) {
LOG.trace(info.getConsumerId() + " failed to dispatch: " + message.getMessageId() + " - "
+ message.getDestination() + ", dispatched: " + dispatchCounter + ", inflight: " + dispatched.size());
}
LOG.trace("{} failed to dispatch: {} - {}, dispatched: {}, inflight: {}", new Object[]{ info.getConsumerId(), message.getMessageId(), message.getDestination(), dispatchCounter, dispatched.size() });
}
}
}
@ -753,10 +746,7 @@ public abstract class PrefetchSubscription extends AbstractSubscription {
if (node != QueueMessageReference.NULL_MESSAGE) {
nodeDest.getDestinationStatistics().getDispatched().increment();
nodeDest.getDestinationStatistics().getInflight().increment();
if (LOG.isTraceEnabled()) {
LOG.trace(info.getConsumerId() + " dispatched: " + message.getMessageId() + " - "
+ message.getDestination() + ", dispatched: " + dispatchCounter + ", inflight: " + dispatched.size());
}
LOG.trace("{} dispatched: {} - {}, dispatched: {}, inflight: {}", new Object[]{ info.getConsumerId(), message.getMessageId(), message.getDestination(), dispatchCounter, dispatched.size() });
}
}

View File

@ -206,11 +206,9 @@ public class Queue extends BaseDestination implements Task, UsageListener {
}
}
} catch (InterruptedException e) {
if (LOG.isDebugEnabled()) {
LOG.debug(getName() + "Producer Flow Control Timeout Task is stopping");
}
}
}
};
private final FlowControlTimeoutTask flowControlTimeoutTask = new FlowControlTimeoutTask();
@ -274,10 +272,8 @@ public class Queue extends BaseDestination implements Task, UsageListener {
@Override
public boolean recoverMessage(Message message) {
recoveredAccumulator++;
if (LOG.isInfoEnabled() && (recoveredAccumulator % 10000) == 0) {
LOG.info("cursor for " + getActiveMQDestination().getQualifiedName() + " has recovered "
+ recoveredAccumulator + " messages. " +
(int) (recoveredAccumulator * 100 / totalMessageCount) + "% complete");
if ((recoveredAccumulator % 10000) == 0) {
LOG.info("cursor for {} has recovered {} messages. {}% complete", new Object[]{ getActiveMQDestination().getQualifiedName(), recoveredAccumulator, new Integer((int) (recoveredAccumulator * 100 / totalMessageCount))});
}
// Message could have expired while it was being
// loaded..
@ -428,12 +424,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
@Override
public void addSubscription(ConnectionContext context, Subscription sub) throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug(getActiveMQDestination().getQualifiedName() + " add sub: " + sub + ", dequeues: "
+ getDestinationStatistics().getDequeues().getCount() + ", dispatched: "
+ getDestinationStatistics().getDispatched().getCount() + ", inflight: "
+ getDestinationStatistics().getInflight().getCount());
}
LOG.debug("{} add sub: {}, dequeues: {}, dispatched: {}, inflight: {}", new Object[]{ getActiveMQDestination().getQualifiedName(), getDestinationStatistics().getDequeues().getCount(), getDestinationStatistics().getDispatched().getCount(), getDestinationStatistics().getInflight().getCount() });
super.addSubscription(context, sub);
// synchronize with dispatch method so that no new messages are sent
@ -504,12 +495,14 @@ public class Queue extends BaseDestination implements Task, UsageListener {
// while removing up a subscription.
pagedInPendingDispatchLock.writeLock().lock();
try {
if (LOG.isDebugEnabled()) {
LOG.debug(getActiveMQDestination().getQualifiedName() + " remove sub: " + sub + ", lastDeliveredSeqId: " + lastDeiveredSequenceId + ", dequeues: "
+ getDestinationStatistics().getDequeues().getCount() + ", dispatched: "
+ getDestinationStatistics().getDispatched().getCount() + ", inflight: "
+ getDestinationStatistics().getInflight().getCount());
}
LOG.debug("{} remove sub: {}, lastDeliveredSeqId: {}, dequeues: {}, dispatched: {}, inflight: {}", new Object[]{
getActiveMQDestination().getQualifiedName(),
sub,
lastDeiveredSequenceId,
getDestinationStatistics().getDequeues().getCount(),
getDestinationStatistics().getDispatched().getCount(),
getDestinationStatistics().getInflight().getCount()
});
consumersLock.writeLock().lock();
try {
removeFromConsumerList(sub);
@ -553,9 +546,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
if (ref.getMessageId().getBrokerSequenceId() == lastDeiveredSequenceId) {
lastDeliveredRef = ref;
markAsRedelivered = true;
if (LOG.isDebugEnabled()) {
LOG.debug("found lastDeliveredSeqID: " + lastDeiveredSequenceId + ", message reference: " + ref.getMessageId());
}
LOG.debug("found lastDeliveredSeqID: {}, message reference: {}", lastDeiveredSequenceId, ref.getMessageId());
break;
}
}
@ -615,7 +606,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
message.setRegionDestination(this);
ProducerState state = producerExchange.getProducerState();
if (state == null) {
LOG.warn("Send failed for: " + message + ", missing producer state for: " + producerExchange);
LOG.warn("Send failed for: {}, missing producer state for: {}", message, producerExchange);
throw new JMSException("Cannot send message to " + getActiveMQDestination() + " with invalid (null) producer state");
}
final ProducerInfo producerInfo = producerExchange.getProducerState().getInfo();
@ -636,12 +627,8 @@ public class Queue extends BaseDestination implements Task, UsageListener {
if (isProducerFlowControl() && context.isProducerFlowControl()) {
if (warnOnProducerFlowControl) {
warnOnProducerFlowControl = false;
LOG.info("Usage Manager Memory Limit ("
+ memoryUsage.getLimit()
+ ") reached on "
+ getActiveMQDestination().getQualifiedName()
+ ". Producers will be throttled to the rate at which messages are removed from this destination to prevent flooding it."
+ " See http://activemq.apache.org/producer-flow-control.html for more info");
LOG.info("Usage Manager Memory Limit ({}) reached on {}. Producers will be throttled to the rate at which messages are removed from this destination to prevent flooding it. See http://activemq.apache.org/producer-flow-control.html for more info.",
memoryUsage.getLimit(), getActiveMQDestination().getQualifiedName());
}
if (!context.isNetworkConnection() && systemUsage.isSendFailIfNoSpace()) {
@ -697,7 +684,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
response.setCorrelationId(message.getCommandId());
context.getConnection().dispatchAsync(response);
} else {
LOG.debug("unexpected exception on deferred send of :" + message, e);
LOG.debug("unexpected exception on deferred send of: {}", message, e);
}
}
}
@ -725,9 +712,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
// The usage manager could have delayed us by the time
// we unblock the message could have expired..
if (message.isExpired()) {
if (LOG.isDebugEnabled()) {
LOG.debug("Expired message: " + message);
}
LOG.debug("Expired message: {}", message);
broker.getRoot().messageExpired(context, message, null);
return;
}
@ -935,17 +920,13 @@ public class Queue extends BaseDestination implements Task, UsageListener {
}
private void expireMessages() {
if (LOG.isDebugEnabled()) {
LOG.debug(getActiveMQDestination().getQualifiedName() + " expiring messages ..");
}
LOG.debug("{} expiring messages ..", getActiveMQDestination().getQualifiedName());
// just track the insertion count
List<Message> browsedMessages = new InsertionCountList<Message>();
doBrowse(browsedMessages, this.getMaxExpirePageSize());
asyncWakeup();
if (LOG.isDebugEnabled()) {
LOG.debug(getActiveMQDestination().getQualifiedName() + " expiring messages done.");
}
LOG.debug("{} expiring messages done.", getActiveMQDestination().getQualifiedName());
}
@Override
@ -1143,9 +1124,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
for (MessageReference ref : toExpire) {
pagedInPendingDispatch.remove(ref);
if (broker.isExpired(ref)) {
if (LOG.isDebugEnabled()) {
LOG.debug("expiring from pagedInPending: " + ref);
}
LOG.debug("expiring from pagedInPending: {}", ref);
messageExpired(connectionContext, ref);
}
}
@ -1161,9 +1140,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
}
for (MessageReference ref : toExpire) {
if (broker.isExpired(ref)) {
if (LOG.isDebugEnabled()) {
LOG.debug("expiring from pagedInMessages: " + ref);
}
LOG.debug("expiring from pagedInMessages: {}", ref);
messageExpired(connectionContext, ref);
} else {
pagedInMessagesLock.writeLock().lock();
@ -1184,9 +1161,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
MessageReference node = messages.next();
if (node.isExpired()) {
if (broker.isExpired(node)) {
if (LOG.isDebugEnabled()) {
LOG.debug("expiring from messages: " + node);
}
LOG.debug("expiring from messages: {}", node);
messageExpired(connectionContext, createMessageReference(node.getMessage()));
}
messages.remove();
@ -1279,9 +1254,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
} while (!list.isEmpty() && this.destinationStatistics.getMessages().getCount() > 0);
if (this.destinationStatistics.getMessages().getCount() > 0) {
LOG.warn(getActiveMQDestination().getQualifiedName()
+ " after purge complete, message count stats report: "
+ this.destinationStatistics.getMessages().getCount());
LOG.warn("{} after purge complete, message count stats report: {}", getActiveMQDestination().getQualifiedName(), this.destinationStatistics.getMessages().getCount());
}
gc();
this.destinationStatistics.getMessages().setCount(0);
@ -1590,21 +1563,14 @@ public class Queue extends BaseDestination implements Task, UsageListener {
timeout = timeBeforeDispatchStarts;
}
if (consumersBeforeStartsLatch.await(timeout, TimeUnit.MILLISECONDS)) {
if (LOG.isDebugEnabled()) {
LOG.debug(consumers.size() + " consumers subscribed. Starting dispatch.");
}
LOG.debug("{} consumers subscribed. Starting dispatch.", consumers.size());
} else {
if (LOG.isDebugEnabled()) {
LOG.debug(timeout + " ms elapsed and " + consumers.size()
+ " consumers subscribed. Starting dispatch.");
}
LOG.debug("{} ms elapsed and {} consumers subscribed. Starting dispatch.", timeout, consumers.size());
}
}
if (timeBeforeDispatchStarts > 0 && consumersBeforeDispatchStarts <= 0) {
iteratingMutex.wait(timeBeforeDispatchStarts);
if (LOG.isDebugEnabled()) {
LOG.debug(timeBeforeDispatchStarts + " ms elapsed. Starting dispatch.");
}
LOG.debug("{} ms elapsed. Starting dispatch.", timeBeforeDispatchStarts);
}
} catch (Exception e) {
LOG.error(e.toString());
@ -1658,10 +1624,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
QueueBrowserSubscription browser = browserDispatch.getBrowser();
if (LOG.isDebugEnabled()) {
LOG.debug("dispatch to browser: " + browser
+ ", already dispatched/paged count: " + alreadyDispatchedMessages.size());
}
LOG.debug("dispatch to browser: {}, already dispatched/paged count: {}", browser, alreadyDispatchedMessages.size());
boolean added = false;
for (QueueMessageReference node : alreadyDispatchedMessages) {
if (!node.isAcked() && !browser.isDuplicate(node.getMessageId())) {
@ -1678,7 +1641,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
browserDispatches.remove(browserDispatch);
}
} catch (Exception e) {
LOG.warn("exception on dispatch to browser: " + browserDispatch.getBrowser(), e);
LOG.warn("exception on dispatch to browser: {}", browserDispatch.getBrowser(), e);
}
}
}
@ -1814,9 +1777,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
@Override
public void messageExpired(ConnectionContext context, Subscription subs, MessageReference reference) {
if (LOG.isDebugEnabled()) {
LOG.debug("message expired: " + reference);
}
LOG.debug("message expired: {}", reference);
broker.messageExpired(context, reference, subs);
destinationStatistics.getExpired().increment();
try {
@ -1854,9 +1815,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
}finally {
consumersLock.readLock().unlock();
}
if (LOG.isDebugEnabled()) {
LOG.debug(broker.getBrokerName() + " Message " + msg.getMessageId() + " sent to " + this.destination);
}
LOG.debug("{} Message {} sent to {}", new Object[]{ broker.getBrokerName(), msg.getMessageId(), this.destination });
wakeup();
}
@ -1907,13 +1866,15 @@ public class Queue extends BaseDestination implements Task, UsageListener {
PendingList resultList = null;
int toPageIn = Math.min(getMaxPageSize(), messages.size());
if (LOG.isDebugEnabled()) {
LOG.debug(destination.getPhysicalName() + " toPageIn: " + toPageIn + ", Inflight: "
+ destinationStatistics.getInflight().getCount() + ", pagedInMessages.size "
+ pagedInMessages.size() + ", enqueueCount: " + destinationStatistics.getEnqueues().getCount()
+ ", dequeueCount: " + destinationStatistics.getDequeues().getCount());
}
LOG.debug("{} toPageIn: {}, Inflight: {}, pagedInMessages.size {}, enqueueCount: {}, dequeueCount: {}",
new Object[]{
destination.getPhysicalName(),
toPageIn,
destinationStatistics.getInflight().getCount(),
pagedInMessages.size(),
destinationStatistics.getEnqueues().getCount(),
destinationStatistics.getDequeues().getCount()
});
if (isLazyDispatch() && !force) {
// Only page in the minimum number of messages which can be
// dispatched immediately.
@ -2153,7 +2114,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
try {
activeMessage.setBooleanProperty("JMSXGroupFirstForConsumer", true, false);
} catch (JMSException e) {
LOG.warn("Failed to set boolean header: " + e, e);
LOG.warn("Failed to set boolean header", e);
}
}
subs.getConsumerInfo().setLastDeliveredSequenceId(subs.getConsumerInfo().getLastDeliveredSequenceId() + 1);

View File

@ -56,9 +56,7 @@ public class QueueSubscription extends PrefetchSubscription implements LockOwner
if (n.isExpired()) {
// sync with message expiry processing
if (!broker.isExpired(n)) {
if (LOG.isDebugEnabled()) {
LOG.debug("ignoring ack {}, for already expired message: {}", ack, n);
}
return;
}
}

View File

@ -234,10 +234,10 @@ public class RegionBroker extends EmptyBroker {
if (context.isAllowLinkStealing()){
clientIdSet.remove(clientId);
if (oldContext.getConnection() != null) {
LOG.warn("Stealing link for clientId " + clientId + " From Connection " + oldContext.getConnection());
LOG.warn("Stealing link for clientId {} From Connection {}", clientId, oldContext.getConnection());
oldContext.getConnection().stop();
}else{
LOG.error("Not Connection for " + oldContext);
LOG.error("Not Connection for {}", oldContext);
}
}else{
throw new InvalidClientIDException("Broker: " + getBrokerName() + " - Client: " + clientId + " already connected from "
@ -560,9 +560,7 @@ public class RegionBroker extends EmptyBroker {
brokerInfos.put(info.getBrokerId(), existing);
}
existing.incrementRefCount();
if (LOG.isDebugEnabled()) {
LOG.debug(getBrokerName() + " addBroker:" + info.getBrokerName() + " brokerInfo size : " + brokerInfos.size());
}
LOG.debug("{} addBroker: {} brokerInfo size: {}", new Object[]{ getBrokerName(), info.getBrokerName(), brokerInfos.size() });
addBrokerInClusterUpdate(info);
}
@ -573,9 +571,7 @@ public class RegionBroker extends EmptyBroker {
if (existing != null && existing.decrementRefCount() == 0) {
brokerInfos.remove(info.getBrokerId());
}
if (LOG.isDebugEnabled()) {
LOG.debug(getBrokerName() + " removeBroker:" + info.getBrokerName() + " brokerInfo size : " + brokerInfos.size());
}
LOG.debug("{} removeBroker: {} brokerInfo size: {}", new Object[]{ getBrokerName(), info.getBrokerName(), brokerInfos.size()});
// When stopping don't send cluster updates since we are the one's tearing down
// our own bridges.
if (!brokerService.isStopping()) {
@ -688,7 +684,7 @@ public class RegionBroker extends EmptyBroker {
expired = stampAsExpired(message);
}
} catch (IOException e) {
LOG.warn("unexpected exception on message expiry determination for: " + messageReference, e);
LOG.warn("unexpected exception on message expiry determination for: {}", messageReference, e);
}
}
return expired;
@ -706,9 +702,7 @@ public class RegionBroker extends EmptyBroker {
@Override
public void messageExpired(ConnectionContext context, MessageReference node, Subscription subscription) {
if (LOG.isDebugEnabled()) {
LOG.debug("Message expired " + node);
}
LOG.debug("Message expired {}", node);
getRoot().sendToDeadLetterQueue(context, node, subscription, new Throwable("Message Expired. Expiration:" + node.getExpiration()));
}
@ -745,15 +739,12 @@ public class RegionBroker extends EmptyBroker {
return true;
}
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Dead Letter message with no DLQ strategy in place, message id: " + message.getMessageId() + ", destination: "
+ message.getDestination());
}
LOG.debug("Dead Letter message with no DLQ strategy in place, message id: {}, destination: {}", message.getMessageId(), message.getDestination());
}
}
}
} catch (Exception e) {
LOG.warn("Caught an exception sending to DLQ: " + node, e);
LOG.warn("Caught an exception sending to DLQ: {}", node, e);
}
return false;
@ -764,7 +755,7 @@ public class RegionBroker extends EmptyBroker {
try {
return getBrokerService().getBroker();
} catch (Exception e) {
LOG.error("Trying to get Root Broker " + e);
LOG.error("Trying to get Root Broker", e);
throw new RuntimeException("The broker from the BrokerService should not throw an exception");
}
}
@ -795,7 +786,7 @@ public class RegionBroker extends EmptyBroker {
try {
getRegion(destination).processConsumerControl(consumerExchange, control);
} catch (JMSException jmse) {
LOG.warn("unmatched destination: " + destination + ", in consumerControl: " + control);
LOG.warn("unmatched destination: {}, in consumerControl: {}", destination, control);
}
}
@ -849,11 +840,11 @@ public class RegionBroker extends EmptyBroker {
if (dest instanceof BaseDestination) {
log = ((BaseDestination) dest).getLog();
}
log.info(dest.getName() + " Inactive for longer than " + dest.getInactiveTimoutBeforeGC() + " ms - removing ...");
log.info("{} Inactive for longer than {} ms - removing ...", dest.getName(), dest.getInactiveTimoutBeforeGC());
try {
getRoot().removeDestination(context, dest.getActiveMQDestination(), isAllowTempAutoCreationOnSend() ? 1 : 0);
} catch (Exception e) {
LOG.error("Failed to remove inactive destination " + dest, e);
LOG.error("Failed to remove inactive destination {}", dest, e);
}
}
}

View File

@ -76,9 +76,7 @@ public class TempQueue extends Queue{
.getConnectionId()))) {
tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId());
if (LOG.isDebugEnabled()) {
LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId());
}
LOG.debug("changed ownership of {} to {}", this, tempDest.getConnectionId());
}
super.addSubscription(context, sub);
}
@ -86,15 +84,13 @@ public class TempQueue extends Queue{
@Override
public void dispose(ConnectionContext context) throws IOException {
if (this.destinationStatistics.getMessages().getCount() > 0) {
LOG.info(getActiveMQDestination().getQualifiedName()
+ " on dispose, purge of "
+ this.destinationStatistics.getMessages().getCount() + " pending messages: " + messages);
LOG.info("{} on dispose, purge of {} pending messages: {}", new Object[]{ getActiveMQDestination().getQualifiedName(), this.destinationStatistics.getMessages().getCount(), messages });
// we may want to capture these message ids in an advisory
}
try {
purge();
} catch (Exception e) {
LOG.warn("Caught an exception purging Queue: " + destination);
LOG.warn("Caught an exception purging Queue: {}", destination, e);
}
super.dispose(context);
}

View File

@ -18,16 +18,12 @@ package org.apache.activemq.broker.region;
import javax.jms.JMSException;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.broker.region.policy.PolicyEntry;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ConsumerInfo;
import org.apache.activemq.command.MessageDispatchNotification;
import org.apache.activemq.thread.TaskRunnerFactory;
import org.apache.activemq.usage.SystemUsage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*

View File

@ -21,7 +21,6 @@ import javax.jms.JMSException;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.broker.region.policy.PolicyEntry;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQTempTopic;
import org.apache.activemq.command.ConsumerInfo;
import org.apache.activemq.thread.TaskRunnerFactory;
import org.apache.activemq.usage.SystemUsage;

View File

@ -272,7 +272,7 @@ public class Topic extends BaseDestination implements Task {
subscription.add(message);
}
} catch (IOException e) {
LOG.error("Failed to recover this message " + message);
LOG.error("Failed to recover this message {}", message, e);
}
return true;
}
@ -340,10 +340,7 @@ public class Topic extends BaseDestination implements Task {
if (warnOnProducerFlowControl) {
warnOnProducerFlowControl = false;
LOG.info(memoryUsage + ", Usage Manager memory limit reached for "
+ getActiveMQDestination().getQualifiedName()
+ ". Producers will be throttled to the rate at which messages are removed from this destination to prevent flooding it."
+ " See http://activemq.apache.org/producer-flow-control.html for more info");
LOG.info("{}, Usage Manager memory limit reached for {}. Producers will be throttled to the rate at which messages are removed from this destination to prevent flooding it. See http://activemq.apache.org/producer-flow-control.html for more info.", getActiveMQDestination().getQualifiedName());
}
if (!context.isNetworkConnection() && systemUsage.isSendFailIfNoSpace()) {
@ -411,8 +408,7 @@ public class Topic extends BaseDestination implements Task {
if (count > 2 && context.isInTransaction()) {
count = 0;
int size = context.getTransaction().size();
LOG.warn("Waiting for space to send transacted message - transaction elements = "
+ size + " need more space to commit. Message = " + message);
LOG.warn("Waiting for space to send transacted message - transaction elements = {} need more space to commit. Message = {}", size, message);
}
count++;
}
@ -434,9 +430,7 @@ public class Topic extends BaseDestination implements Task {
// we unblock the message could have expired..
if (message.isExpired()) {
getDestinationStatistics().getExpired().increment();
if (LOG.isDebugEnabled()) {
LOG.debug("Expired message: " + message);
}
LOG.debug("Expired message: {}", message);
return;
}
}
@ -632,7 +626,7 @@ public class Topic extends BaseDestination implements Task {
}
}
} catch (Throwable e) {
LOG.warn("Failed to browse Topic: " + getActiveMQDestination().getPhysicalName(), e);
LOG.warn("Failed to browse Topic: {}", getActiveMQDestination().getPhysicalName(), e);
}
}
@ -802,9 +796,10 @@ public class Topic extends BaseDestination implements Task {
try {
durableTopicSubscription.dispatchPending();
} catch (IOException exception) {
LOG.warn("After clear of pending, failed to dispatch to: " +
durableTopicSubscription + ", for :" + destination + ", pending: " +
durableTopicSubscription.pending, exception);
LOG.warn("After clear of pending, failed to dispatch to: {}, for: {}, pending: {}", new Object[]{
durableTopicSubscription,
destination,
durableTopicSubscription.pending }, exception);
}
}
}

View File

@ -89,7 +89,7 @@ public class TopicRegion extends AbstractRegion {
if (!sub.isActive()) {
long offline = sub.getOfflineTimestamp();
if (offline != -1 && now - offline >= broker.getBrokerService().getOfflineDurableSubscriberTimeout()) {
LOG.info("Destroying durable subscriber due to inactivity: " + sub);
LOG.info("Destroying durable subscriber due to inactivity: {}", sub);
try {
RemoveSubscriptionInfo info = new RemoveSubscriptionInfo();
info.setClientId(entry.getKey().getClientId());
@ -231,9 +231,7 @@ public class TopicRegion extends AbstractRegion {
for (int i = 0; i < infos.length; i++) {
SubscriptionInfo info = infos[i];
if (LOG.isDebugEnabled()) {
LOG.debug("Restoring durable subscription: " + info);
}
LOG.debug("Restoring durable subscription: {}", info);
SubscriptionKey key = new SubscriptionKey(info);
// A single durable sub may be subscribing to multiple topics.

View File

@ -115,7 +115,7 @@ public class TopicSubscription extends AbstractSubscription {
if (info.getPrefetchSize() > 1 && matched.size() > info.getPrefetchSize()) {
// Slow consumers should log and set their state as such.
if (!isSlowConsumer()) {
LOG.warn(toString() + ": has twice its prefetch limit pending, without an ack; it appears to be slow");
LOG.warn("{}: has twice its prefetch limit pending, without an ack; it appears to be slow", toString());
setSlowConsumer(true);
for (Destination dest: destinations) {
dest.slowConsumer(getContext(), this);
@ -128,18 +128,18 @@ public class TopicSubscription extends AbstractSubscription {
synchronized (matchedListMutex) {
while (matched.isFull()) {
if (getContext().getStopping().get()) {
LOG.warn(toString() + ": stopped waiting for space in pendingMessage cursor for: "
+ node.getMessageId());
LOG.warn("{}: stopped waiting for space in pendingMessage cursor for: {}", toString(), node.getMessageId());
enqueueCounter.decrementAndGet();
return;
}
if (!warnedAboutWait) {
LOG.info(toString() + ": Pending message cursor [" + matched
+ "] is full, temp usage ("
+ +matched.getSystemUsage().getTempUsage().getPercentUsage()
+ "%) or memory usage ("
+ matched.getSystemUsage().getMemoryUsage().getPercentUsage()
+ "%) limit reached, blocking message add() pending the release of resources.");
LOG.info("{}: Pending message cursor [{}] is full, temp usag ({}%) or memory usage ({}%) limit reached, blocking message add() pending the release of resources.",
new Object[]{
toString(),
matched,
matched.getSystemUsage().getTempUsage().getPercentUsage(),
matched.getSystemUsage().getMemoryUsage().getPercentUsage()
});
warnedAboutWait = true;
}
matchedListMutex.wait(20);
@ -188,7 +188,9 @@ public class TopicSubscription extends AbstractSubscription {
// lets avoid an infinite loop if we are given a bad eviction strategy
// for a bad strategy lets just not evict
if (messagesToEvict == 0) {
LOG.warn("No messages to evict returned for " + destination + " from eviction strategy: " + messageEvictionStrategy + " out of " + list.size() + " candidates");
LOG.warn("No messages to evict returned for {} from eviction strategy: {} out of {} candidates", new Object[]{
destination, messageEvictionStrategy, list.size()
});
break;
}
}
@ -205,7 +207,7 @@ public class TopicSubscription extends AbstractSubscription {
duplicate = audit.isDuplicate(node);
if (LOG.isDebugEnabled()) {
if (duplicate) {
LOG.debug(this + ", ignoring duplicate add: " + node.getMessageId());
LOG.debug("{}, ignoring duplicate add: {}", this, node.getMessageId());
}
}
}
@ -623,9 +625,7 @@ public class TopicSubscription extends AbstractSubscription {
if(destination != null) {
destination.getDestinationStatistics().getDequeues().increment();
}
if (LOG.isDebugEnabled()) {
LOG.debug(this + ", discarding message " + message);
}
LOG.debug("{}, discarding message {}", this, message);
Destination dest = (Destination) message.getRegionDestination();
if (dest != null) {
dest.messageDiscarded(getContext(), this, message);

View File

@ -96,9 +96,7 @@ public abstract class AbstractStoreCursor extends AbstractPendingMessageCursor i
* the cache. If subsequently, we pull out that message from the store (before its deleted)
* it will be a duplicate - but should be ignored
*/
if (LOG.isTraceEnabled()) {
LOG.trace(this + " - cursor got duplicate: " + message.getMessageId() + ", " + message.getPriority());
}
LOG.trace("{} - cursor got duplicate: {}, {}", new Object[]{ this, message.getMessageId(), message.getPriority() });
}
return recovered;
}
@ -109,7 +107,7 @@ public abstract class AbstractStoreCursor extends AbstractPendingMessageCursor i
try {
fillBatch();
} catch (Exception e) {
LOG.error(this + " - Failed to fill batch", e);
LOG.error("{} - Failed to fill batch", this, e);
throw new RuntimeException(e);
}
}
@ -146,7 +144,7 @@ public abstract class AbstractStoreCursor extends AbstractPendingMessageCursor i
try {
fillBatch();
} catch (Exception e) {
LOG.error(this + " - Failed to fill batch", e);
LOG.error("{} - Failed to fill batch", this, e);
throw new RuntimeException(e);
}
}
@ -172,9 +170,7 @@ public abstract class AbstractStoreCursor extends AbstractPendingMessageCursor i
boolean disableCache = false;
if (hasSpace()) {
if (!isCacheEnabled() && size==0 && isStarted() && useCache) {
if (LOG.isTraceEnabled()) {
LOG.trace(this + " - enabling cache for empty store " + node.getMessageId());
}
LOG.trace("{} - enabling cache for empty store {}", this, node.getMessageId());
setCacheEnabled(true);
}
if (isCacheEnabled()) {
@ -194,11 +190,7 @@ public abstract class AbstractStoreCursor extends AbstractPendingMessageCursor i
setCacheEnabled(false);
// sync with store on disabling the cache
if (lastCachedId != null) {
if (LOG.isTraceEnabled()) {
LOG.trace(this + " - disabling cache"
+ ", lastCachedId: " + lastCachedId
+ " current node Id: " + node.getMessageId() + " batchList size: " + batchList.size());
}
LOG.trace(this + "{} - disabling cache, lastCachedId: {} current node Id: {} batchList size: {}", new Object[]{ this, lastCachedId, node.getMessageId(), batchList.size() });
setBatch(lastCachedId);
lastCachedId = null;
}
@ -254,9 +246,7 @@ public abstract class AbstractStoreCursor extends AbstractPendingMessageCursor i
}
protected final synchronized void fillBatch() {
if (LOG.isTraceEnabled()) {
LOG.trace(this + " - fillBatch");
}
LOG.trace("{} - fillBatch", this);
if (batchResetNeeded) {
resetSize();
setMaxBatchSize(Math.min(regionDestination.getMaxPageSize(), size));
@ -267,7 +257,7 @@ public abstract class AbstractStoreCursor extends AbstractPendingMessageCursor i
try {
doFillBatch();
} catch (Exception e) {
LOG.error(this + " - Failed to fill batch", e);
LOG.error("{} - Failed to fill batch", this, e);
throw new RuntimeException(e);
}
this.storeHasMessages = !this.batchList.isEmpty() || !hadSpace;

View File

@ -240,7 +240,7 @@ public class FilePendingMessageCursor extends AbstractPendingMessageCursor imple
return false;
} catch (Exception e) {
LOG.error("Caught an Exception adding a message: " + node + " first to FilePendingMessageCursor ", e);
LOG.error("Caught an Exception adding a message: {} first to FilePendingMessageCursor ", node, e);
throw new RuntimeException(e);
}
} else {
@ -287,7 +287,7 @@ public class FilePendingMessageCursor extends AbstractPendingMessageCursor imple
node.getMessageId().setPlistLocator(locator);
} catch (Exception e) {
LOG.error("Caught an Exception adding a message: " + node + " first to FilePendingMessageCursor ", e);
LOG.error("Caught an Exception adding a message: {} first to FilePendingMessageCursor ", node, e);
throw new RuntimeException(e);
}
} else {
@ -433,7 +433,7 @@ public class FilePendingMessageCursor extends AbstractPendingMessageCursor imple
long start = 0;
if (LOG.isTraceEnabled()) {
start = System.currentTimeMillis();
LOG.trace("" + name + ", flushToDisk() mem list size: " +memoryList.size() + " " + (systemUsage != null ? systemUsage.getMemoryUsage() : "") );
LOG.trace("{}, flushToDisk() mem list size: {} {}", new Object[]{ name, memoryList.size(), (systemUsage != null ? systemUsage.getMemoryUsage() : "") });
}
for (Iterator<MessageReference> iterator = memoryList.iterator(); iterator.hasNext();) {
MessageReference node = iterator.next();
@ -450,9 +450,7 @@ public class FilePendingMessageCursor extends AbstractPendingMessageCursor imple
}
memoryList.clear();
setCacheEnabled(false);
if (LOG.isTraceEnabled()) {
LOG.trace("" + name + ", flushToDisk() done - " + (System.currentTimeMillis() - start) + "ms " + (systemUsage != null ? systemUsage.getMemoryUsage() : ""));
}
LOG.trace("{}, flushToDisk() done - {} ms {}", new Object[]{ name, (System.currentTimeMillis() - start), (systemUsage != null ? systemUsage.getMemoryUsage() : "") });
}
}
@ -465,7 +463,7 @@ public class FilePendingMessageCursor extends AbstractPendingMessageCursor imple
try {
diskList = store.getPList(name);
} catch (Exception e) {
LOG.error("Caught an IO Exception getting the DiskList " + name, e);
LOG.error("Caught an IO Exception getting the DiskList {}", name, e);
throw new RuntimeException(e);
}
}
@ -473,9 +471,7 @@ public class FilePendingMessageCursor extends AbstractPendingMessageCursor imple
}
private void discardExpiredMessage(MessageReference reference) {
if (LOG.isDebugEnabled()) {
LOG.debug("Discarding expired message " + reference);
}
LOG.debug("Discarding expired message {}", reference);
if (broker.isExpired(reference)) {
ConnectionContext context = new ConnectionContext(new NonCachedMessageEvaluationContext());
context.setBroker(broker);

View File

@ -199,11 +199,7 @@ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor {
if (prioritizedMessages && immediatePriorityDispatch && tsp.isPaging()) {
if (msg.getPriority() > tsp.getLastRecoveredPriority()) {
tsp.recoverMessage(node.getMessage(), true);
if (LOG.isTraceEnabled()) {
LOG.trace("cached high priority (" + msg.getPriority() + ") message:" +
msg.getMessageId() + ", current paged batch priority: " +
tsp.getLastRecoveredPriority() + ", cache size:" + tsp.batchList.size());
}
LOG.trace("cached high priority ({} message: {}, current paged batch priority: {}, cache size: {}", new Object[]{ msg.getPriority(), msg.getMessageId(), tsp.getLastRecoveredPriority(), tsp.batchList.size()});
}
}
}

View File

@ -69,9 +69,7 @@ class TopicStorePrefetch extends AbstractStoreCursor {
@Override
public synchronized boolean recoverMessage(Message message, boolean cached) throws Exception {
if (LOG.isTraceEnabled()) {
LOG.trace("recover: " + message.getMessageId() + ", priority: " + message.getPriority());
}
LOG.trace("recover: {}, priority: {}", message.getMessageId(), message.getPriority());
boolean recovered = false;
MessageEvaluationContext messageEvaluationContext = new NonCachedMessageEvaluationContext();
messageEvaluationContext.setMessageReference(message);
@ -89,7 +87,7 @@ class TopicStorePrefetch extends AbstractStoreCursor {
try {
return store.getMessageCount(clientId, subscriberName);
} catch (Exception e) {
LOG.error(this + " Failed to get the outstanding message count from the store", e);
LOG.error("{} Failed to get the outstanding message count from the store", this, e);
throw new RuntimeException(e);
}
}

View File

@ -124,9 +124,7 @@ public class AbortSlowAckConsumerStrategy extends AbortSlowConsumerStrategy {
if (timeDelta > maxTimeSinceLastAck) {
if (!slowConsumers.containsKey(subscriber)) {
if (LOG.isDebugEnabled()) {
LOG.debug("sub: {} is now slow", subscriber.getConsumerInfo().getConsumerId());
}
slowConsumers.put(subscriber, new SlowConsumerEntry(subscriber.getContext()));
} else if (getMaxSlowCount() > 0) {
slowConsumers.get(subscriber).slow();
@ -145,22 +143,14 @@ public class AbortSlowAckConsumerStrategy extends AbortSlowConsumerStrategy {
if (getMaxSlowDuration() > 0 && (entry.getValue().markCount * getCheckPeriod() > getMaxSlowDuration()) ||
getMaxSlowCount() > 0 && entry.getValue().slowCount > getMaxSlowCount()) {
if (LOG.isTraceEnabled()) {
LOG.trace("Transferring consumer {} to the abort list: " +
"slow duration = " + entry.getValue().markCount * getCheckPeriod() + ", " +
"slow count = " + entry.getValue().slowCount,
entry.getKey().getConsumerInfo().getConsumerId());
}
LOG.trace("Transferring consumer{} to the abort list: {} slow duration = {}, slow count = {}", new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(), entry.getValue().markCount * getCheckPeriod(), entry.getValue().getSlowCount() });
toAbort.put(entry.getKey(), entry.getValue());
slowConsumers.remove(entry.getKey());
} else {
if (LOG.isTraceEnabled()) {
LOG.trace("Not yet time to abot consumer {}: " +
"slow duration = " + entry.getValue().markCount * getCheckPeriod() + ", " +
"slow count = " + entry.getValue().slowCount,
entry.getKey().getConsumerInfo().getConsumerId());
}
LOG.trace("Not yet time to abort consumer {}: slow duration = {}, slow count = {}", new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(), entry.getValue().markCount * getCheckPeriod(), entry.getValue().slowCount });
}
}

View File

@ -47,9 +47,7 @@ public abstract class AbstractDeadLetterStrategy implements DeadLetterStrategy {
result = true;
if (enableAudit && messageAudit.isDuplicate(message)) {
result = false;
if (LOG.isDebugEnabled()) {
LOG.debug("Not adding duplicate to DLQ: " + message.getMessageId() + ", dest: " + message.getDestination());
}
LOG.debug("Not adding duplicate to DLQ: {}, dest: {}", message.getMessageId(), message.getDestination());
}
if (!message.isPersistent() && !processNonPersistent) {
result = false;

View File

@ -18,9 +18,7 @@ public class DiscardingDeadLetterStrategy extends SharedDeadLetterStrategy {
@Override
public boolean isSendToDeadLetterQueue(Message message) {
boolean result = false;
if (LOG.isDebugEnabled()) {
LOG.debug("Discarding message sent to DLQ: " + message.getMessageId() + ", dest: " + message.getDestination());
}
LOG.debug("Discarding message sent to DLQ: {}, dest: {}", message.getMessageId(), message.getDestination());
return result;
}
}

View File

@ -225,9 +225,7 @@ public class PolicyEntry extends DestinationMapEntry {
}
}
if (value >= 0) {
if (LOG.isDebugEnabled()) {
LOG.debug("Setting the maximumPendingMessages size to: " + value + " for consumer: " + subscription.getInfo().getConsumerId());
}
LOG.debug("Setting the maximumPendingMessages size to: {} for consumer: {}", value, subscription.getInfo().getConsumerId());
subscription.setMaximumPendingMessages(value);
}
}

View File

@ -56,14 +56,13 @@ public class PriorityNetworkDispatchPolicy extends SimpleDispatchPolicy {
} else {
// higher priority matching sub exists
highestPrioritySub = false;
if (LOG.isDebugEnabled()) {
LOG.debug("ignoring lower priority: " + candidate
+ "[" +candidate.getConsumerInfo().getNetworkConsumerIds() +", "
+ candidate.getConsumerInfo().getNetworkConsumerIds() +"] in favour of: "
+ sub
+ "[" +sub.getConsumerInfo().getNetworkConsumerIds() +", "
+ sub.getConsumerInfo().getNetworkConsumerIds() +"]");
}
LOG.debug("ignoring lower priority: {} [{}, {}] in favour of: {} [{}, {}]",
new Object[]{ candidate,
candidate.getConsumerInfo().getNetworkConsumerIds(),
candidate.getConsumerInfo().getNetworkConsumerIds(),
sub,
sub.getConsumerInfo().getNetworkConsumerIds(),
sub.getConsumerInfo().getNetworkConsumerIds() });
}
}
}

View File

@ -114,7 +114,7 @@ public class QueryBasedSubscriptionRecoveryPolicy implements SubscriptionRecover
configure(activeMessage);
sub.addRecoveredMessage(context, activeMessage);
} catch (Throwable e) {
LOG.warn("Failed to dispatch initial message: " + message + " into subscription. Reason: " + e, e);
LOG.warn("Failed to dispatch initial message: {} into subscription. Reason: ", message, e);
}
}

View File

@ -21,8 +21,6 @@ import java.util.List;
import org.apache.activemq.broker.region.MessageReference;
import org.apache.activemq.broker.region.Subscription;
import org.apache.activemq.filter.MessageEvaluationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Simple dispatch policy that sends a message to every subscription that
@ -32,7 +30,6 @@ import org.slf4j.LoggerFactory;
*
*/
public class RoundRobinDispatchPolicy implements DispatchPolicy {
static final Logger LOG = LoggerFactory.getLogger(RoundRobinDispatchPolicy.class);
/**
* @param node

View File

@ -40,7 +40,6 @@ public interface SubscriptionRecoveryPolicy extends Service {
*
* @param context
* @param message
* @param node
* @return true if successful
* @throws Exception
*/
@ -52,7 +51,6 @@ public interface SubscriptionRecoveryPolicy extends Service {
* @param context
* @param topic
* @param sub
* @param node
* @throws Exception
*/
void recover(ConnectionContext context, Topic topic, SubscriptionRecovery sub) throws Exception;

View File

@ -17,8 +17,6 @@
package org.apache.activemq.broker.region.policy;
import org.apache.activemq.broker.region.MessageReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.HashMap;
@ -35,8 +33,6 @@ import java.util.LinkedList;
*/
public class UniquePropertyMessageEvictionStrategy extends MessageEvictionStrategySupport {
private static final Logger LOG = LoggerFactory.getLogger(UniquePropertyMessageEvictionStrategy.class);
protected String propertyName;
public String getPropertyName() {

View File

@ -18,7 +18,6 @@ package org.apache.activemq.broker.region.policy;
import org.apache.activemq.broker.Broker;
import org.apache.activemq.broker.region.DurableTopicSubscription;
import org.apache.activemq.broker.region.Subscription;
import org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor;
import org.apache.activemq.broker.region.cursors.PendingMessageCursor;
import org.apache.activemq.broker.region.cursors.VMPendingMessageCursor;

View File

@ -62,7 +62,7 @@ public class MirroredQueue implements DestinationInterceptor, BrokerServiceAware
}
}
catch (Exception e) {
LOG.error("Failed to lookup the mirror destination for: " + destination + ". Reason: " + e, e);
LOG.error("Failed to lookup the mirror destination for: {}", destination, e);
}
}
}
@ -79,7 +79,7 @@ public class MirroredQueue implements DestinationInterceptor, BrokerServiceAware
try {
brokerService.removeDestination(topic);
} catch (Exception e) {
LOG.error("Failed to remove mirror destination for " + destination + ". Reason: " + e,e);
LOG.error("Failed to remove mirror destination for {}", destination, e);
}
}

View File

@ -16,7 +16,6 @@
*/
package org.apache.activemq.broker.region.virtual;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.broker.region.Destination;
import org.apache.activemq.broker.region.DestinationInterceptor;
import org.apache.activemq.command.ActiveMQDestination;

View File

@ -20,9 +20,6 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
public class JobSupport {
public static String getDateTime(long value) {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

View File

@ -271,9 +271,7 @@ public class SchedulerBroker extends BrokerFilter implements JobListener {
messageSend.setExpiration(expiration);
}
messageSend.setTimestamp(newTimeStamp);
if (LOG.isDebugEnabled()) {
LOG.debug("Set message " + messageSend.getMessageId() + " timestamp from " + oldTimestamp + " to " + newTimeStamp);
}
LOG.debug("Set message {} timestamp from {} to {}", new Object[]{ messageSend.getMessageId(), oldTimestamp, newTimeStamp });
}
}
@ -283,7 +281,7 @@ public class SchedulerBroker extends BrokerFilter implements JobListener {
producerExchange.setProducerState(new ProducerState(new ProducerInfo()));
super.send(producerExchange, messageSend);
} catch (Exception e) {
LOG.error("Failed to send scheduled message " + id, e);
LOG.error("Failed to send scheduled message {}", id, e);
}
}
@ -327,7 +325,7 @@ public class SchedulerBroker extends BrokerFilter implements JobListener {
context.setProducerFlowControl(originalFlowControl);
}
} catch (Exception e) {
LOG.error("Failed to send scheduled message " + job.getJobId(), e);
LOG.error("Failed to send scheduled message {}", job.getJobId(), e);
}
}
}

View File

@ -71,7 +71,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
* @org.apache.xbean.InitMethod
*/
public void afterPropertiesSet() throws Exception {
LOG.info("Created LoggingBrokerPlugin: " + this.toString());
LOG.info("Created LoggingBrokerPlugin: {}", this.toString());
}
public boolean isLogAll() {
@ -165,11 +165,9 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception {
if (isLogAll() || isLogConsumerEvents()) {
LOG.info("Acknowledging message for client ID : " + consumerExchange.getConnectionContext().getClientId()
+ (ack.getMessageCount() == 1 ? ", " + ack.getLastMessageId() : ""));
if (LOG.isTraceEnabled() && ack.getMessageCount() > 1) {
LOG.trace("Message count: " + ack.getMessageCount() + ", First Message Id: " + ack.getFirstMessageId()
+ ", Last Message Id: " + ack.getLastMessageId());
LOG.info("Acknowledging message for client ID: {}{}", consumerExchange.getConnectionContext().getClientId(), (ack.getMessageCount() == 1 ? ", " + ack.getLastMessageId() : ""));
if (ack.getMessageCount() > 1) {
LOG.trace("Message count: {}, First Message Id: {}, Last Message Id: {}", new Object[]{ ack.getMessageCount(), ack.getFirstMessageId(), ack.getLastMessageId() });
}
}
super.acknowledge(consumerExchange, ack);
@ -178,7 +176,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public Response messagePull(ConnectionContext context, MessagePull pull) throws Exception {
if (isLogAll() || isLogConsumerEvents()) {
LOG.info("Message Pull from : " + context.getClientId() + " on " + pull.getDestination().getPhysicalName());
LOG.info("Message Pull from: {} on {}", context.getClientId(), pull.getDestination().getPhysicalName());
}
return super.messagePull(context, pull);
}
@ -186,7 +184,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
if (isLogAll() || isLogConnectionEvents()) {
LOG.info("Adding Connection : " + info);
LOG.info("Adding Connection: {}", info);
}
super.addConnection(context, info);
}
@ -194,7 +192,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
if (isLogAll() || isLogConsumerEvents()) {
LOG.info("Adding Consumer : " + info);
LOG.info("Adding Consumer: {}", info);
}
return super.addConsumer(context, info);
}
@ -202,7 +200,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception {
if (isLogAll() || isLogProducerEvents()) {
LOG.info("Adding Producer :" + info);
LOG.info("Adding Producer: {}", info);
}
super.addProducer(context, info);
}
@ -210,7 +208,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception {
if (isLogAll() || isLogTransactionEvents()) {
LOG.info("Commiting transaction : " + xid.getTransactionKey());
LOG.info("Committing transaction: {}", xid.getTransactionKey());
}
super.commitTransaction(context, xid, onePhase);
}
@ -218,7 +216,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception {
if (isLogAll() || isLogConsumerEvents()) {
LOG.info("Removing subscription : " + info);
LOG.info("Removing subscription: {}", info);
}
super.removeSubscription(context, info);
}
@ -235,7 +233,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
}
tids.append(tid.getTransactionKey());
}
LOG.info("Prepared transactions : " + tids);
LOG.info("Prepared transactions: {}", tids);
}
return result;
}
@ -243,7 +241,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public int prepareTransaction(ConnectionContext context, TransactionId xid) throws Exception {
if (isLogAll() || isLogTransactionEvents()) {
LOG.info("Preparing transaction : " + xid.getTransactionKey());
LOG.info("Preparing transaction: {}", xid.getTransactionKey());
}
return super.prepareTransaction(context, xid);
}
@ -251,7 +249,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {
if (isLogAll() || isLogConnectionEvents()) {
LOG.info("Removing Connection : " + info);
LOG.info("Removing Connection: {}", info);
}
super.removeConnection(context, info, error);
}
@ -259,7 +257,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
if (isLogAll() || isLogConsumerEvents()) {
LOG.info("Removing Consumer : " + info);
LOG.info("Removing Consumer: {}", info);
}
super.removeConsumer(context, info);
}
@ -267,7 +265,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception {
if (isLogAll() || isLogProducerEvents()) {
LOG.info("Removing Producer : " + info);
LOG.info("Removing Producer: {}", info);
}
super.removeProducer(context, info);
}
@ -275,7 +273,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception {
if (isLogAll() || isLogTransactionEvents()) {
LOG.info("Rolling back Transaction : " + xid.getTransactionKey());
LOG.info("Rolling back Transaction: {}", xid.getTransactionKey());
}
super.rollbackTransaction(context, xid);
}
@ -295,13 +293,13 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
perDestinationsLogger = LoggerFactory.getLogger(LOG.getName() +
"." + destination.getDestinationTypeAsString() + "." + destination.getPhysicalName());
}
perDestinationsLogger.info("Sending message : " + copy);
perDestinationsLogger.info("Sending message: {}", copy);
}
@Override
public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception {
if (isLogAll() || isLogTransactionEvents()) {
LOG.info("Beginning transaction : " + xid.getTransactionKey());
LOG.info("Beginning transaction: {}", xid.getTransactionKey());
}
super.beginTransaction(context, xid);
}
@ -309,7 +307,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void forgetTransaction(ConnectionContext context, TransactionId transactionId) throws Exception {
if (isLogAll() || isLogTransactionEvents()) {
LOG.info("Forgetting transaction : " + transactionId.getTransactionKey());
LOG.info("Forgetting transaction: {}", transactionId.getTransactionKey());
}
super.forgetTransaction(context, transactionId);
}
@ -327,7 +325,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
cids.append(cids.length() > 0 ? ", " : "");
cids.append(c.getConnectionId());
}
LOG.info("Connected clients : " + cids);
LOG.info("Connected clients: {}", cids);
}
}
return super.getClients();
@ -337,8 +335,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
public org.apache.activemq.broker.region.Destination addDestination(ConnectionContext context,
ActiveMQDestination destination, boolean create) throws Exception {
if (isLogAll() || isLogInternalEvents()) {
LOG.info("Adding destination : " + destination.getDestinationTypeAsString() + ":"
+ destination.getPhysicalName());
LOG.info("Adding destination: {}:{}", destination.getDestinationTypeAsString(), destination.getPhysicalName());
}
return super.addDestination(context, destination, create);
}
@ -347,8 +344,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout)
throws Exception {
if (isLogAll() || isLogInternalEvents()) {
LOG.info("Removing destination : " + destination.getDestinationTypeAsString() + ":"
+ destination.getPhysicalName());
LOG.info("Removing destination: {}:{}", destination.getDestinationTypeAsString(), destination.getPhysicalName());
}
super.removeDestination(context, destination, timeout);
}
@ -365,7 +361,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
destinations.append(destinations.length() > 0 ? ", " : "");
destinations.append(dest.getPhysicalName());
}
LOG.info("Get Destinations : " + destinations);
LOG.info("Get Destinations: {}", destinations);
}
}
return result;
@ -374,7 +370,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void start() throws Exception {
if (isLogAll() || isLogInternalEvents()) {
LOG.info("Starting " + getBrokerName());
LOG.info("Starting {}", getBrokerName());
}
super.start();
}
@ -382,7 +378,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void stop() throws Exception {
if (isLogAll() || isLogInternalEvents()) {
LOG.info("Stopping " + getBrokerName());
LOG.info("Stopping {}", getBrokerName());
}
super.stop();
}
@ -390,7 +386,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void addSession(ConnectionContext context, SessionInfo info) throws Exception {
if (isLogAll() || isLogSessionEvents()) {
LOG.info("Adding Session : " + info);
LOG.info("Adding Session: {}", info);
}
super.addSession(context, info);
}
@ -398,7 +394,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void removeSession(ConnectionContext context, SessionInfo info) throws Exception {
if (isLogAll() || isLogSessionEvents()) {
LOG.info("Removing Session : " + info);
LOG.info("Removing Session: {}", info);
}
super.removeSession(context, info);
}
@ -406,7 +402,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void addBroker(Connection connection, BrokerInfo info) {
if (isLogAll() || isLogInternalEvents()) {
LOG.info("Adding Broker " + info.getBrokerName());
LOG.info("Adding Broker {}", info.getBrokerName());
}
super.addBroker(connection, info);
}
@ -414,7 +410,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void removeBroker(Connection connection, BrokerInfo info) {
if (isLogAll() || isLogInternalEvents()) {
LOG.info("Removing Broker " + info.getBrokerName());
LOG.info("Removing Broker {}", info.getBrokerName());
}
super.removeBroker(connection, info);
}
@ -431,7 +427,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
peers.append(peers.length() > 0 ? ", " : "");
peers.append(bi.getBrokerName());
}
LOG.info("Get Peer Broker Infos : " + peers);
LOG.info("Get Peer Broker Infos: {}", peers);
}
}
return result;
@ -440,7 +436,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void preProcessDispatch(MessageDispatch messageDispatch) {
if (isLogAll() || isLogInternalEvents() || isLogConsumerEvents()) {
LOG.info("preProcessDispatch :" + messageDispatch);
LOG.info("preProcessDispatch: {}", messageDispatch);
}
super.preProcessDispatch(messageDispatch);
}
@ -448,7 +444,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void postProcessDispatch(MessageDispatch messageDispatch) {
if (isLogAll() || isLogInternalEvents() || isLogConsumerEvents()) {
LOG.info("postProcessDispatch :" + messageDispatch);
LOG.info("postProcessDispatch: {}", messageDispatch);
}
super.postProcessDispatch(messageDispatch);
}
@ -456,7 +452,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception {
if (isLogAll() || isLogInternalEvents() || isLogConsumerEvents()) {
LOG.info("ProcessDispatchNotification :" + messageDispatchNotification);
LOG.info("ProcessDispatchNotification: {}", messageDispatchNotification);
}
super.processDispatchNotification(messageDispatchNotification);
}
@ -473,7 +469,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
destinations.append(destinations.length() > 0 ? ", " : "");
destinations.append(dest.getPhysicalName());
}
LOG.info("Get Durable Destinations : " + destinations);
LOG.info("Get Durable Destinations: {}", destinations);
}
}
return result;
@ -482,7 +478,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception {
if (isLogAll() || isLogInternalEvents()) {
LOG.info("Adding destination info : " + info);
LOG.info("Adding destination info: {}", info);
}
super.addDestinationInfo(context, info);
}
@ -490,7 +486,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void removeDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception {
if (isLogAll() || isLogInternalEvents()) {
LOG.info("Removing destination info : " + info);
LOG.info("Removing destination info: {}", info);
}
super.removeDestinationInfo(context, info);
}
@ -502,7 +498,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
msg = message.getMessage().toString();
LOG.info("Message has expired : " + msg);
LOG.info("Message has expired: {}", msg);
}
super.messageExpired(context, message, subscription);
}
@ -515,7 +511,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
msg = messageReference.getMessage().toString();
LOG.info("Sending to DLQ : " + msg);
LOG.info("Sending to DLQ: {}", msg);
}
return super.sendToDeadLetterQueue(context, messageReference, subscription, poisonCause);
}
@ -523,7 +519,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void fastProducer(ConnectionContext context, ProducerInfo producerInfo,ActiveMQDestination destination) {
if (isLogAll() || isLogProducerEvents() || isLogInternalEvents()) {
LOG.info("Fast Producer : " + producerInfo);
LOG.info("Fast Producer: {}", producerInfo);
}
super.fastProducer(context, producerInfo, destination);
}
@ -531,7 +527,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void isFull(ConnectionContext context, Destination destination, Usage usage) {
if (isLogAll() || isLogProducerEvents() || isLogInternalEvents()) {
LOG.info("Destination is full : " + destination.getName());
LOG.info("Destination is full: {}", destination.getName());
}
super.isFull(context, destination, usage);
}
@ -543,7 +539,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
msg = messageReference.getMessage().toString();
LOG.info("Message consumed : " + msg);
LOG.info("Message consumed: {}", msg);
}
super.messageConsumed(context, messageReference);
}
@ -555,7 +551,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
msg = messageReference.getMessage().toString();
LOG.info("Message delivered : " + msg);
LOG.info("Message delivered: {}", msg);
}
super.messageDelivered(context, messageReference);
}
@ -567,7 +563,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
msg = messageReference.getMessage().toString();
LOG.info("Message discarded : " + msg);
LOG.info("Message discarded: {}", msg);
}
super.messageDiscarded(context, sub, messageReference);
}
@ -575,7 +571,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void slowConsumer(ConnectionContext context, Destination destination, Subscription subs) {
if (isLogAll() || isLogConsumerEvents() || isLogInternalEvents()) {
LOG.info("Detected slow consumer on " + destination.getName());
LOG.info("Detected slow consumer on {}", destination.getName());
StringBuffer buf = new StringBuffer("Connection(");
buf.append(subs.getConsumerInfo().getConsumerId().getConnectionId());
buf.append(") Session(");
@ -589,7 +585,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
@Override
public void nowMasterBroker() {
if (isLogAll() || isLogInternalEvents()) {
LOG.info("Is now the master broker : " + getBrokerName());
LOG.info("Is now the master broker: {}", getBrokerName());
}
super.nowMasterBroker();
}

View File

@ -148,12 +148,12 @@ public class RedeliveryPlugin extends BrokerPluginSupport {
} else if (isSendToDlqIfMaxRetriesExceeded()) {
return super.sendToDeadLetterQueue(context, messageReference, subscription, poisonCause);
} else {
LOG.debug("Discarding message that exceeds max redelivery count( " + maximumRedeliveries + "), " + messageReference.getMessageId());
LOG.debug("Discarding message that exceeds max redelivery count({}), {}", maximumRedeliveries, messageReference.getMessageId());
}
} else if (isFallbackToDeadLetter()) {
return super.sendToDeadLetterQueue(context, messageReference, subscription, poisonCause);
} else {
LOG.debug("Ignoring dlq request for:" + messageReference.getMessageId() + ", RedeliveryPolicy not found (and no fallback) for: " + regionDestination.getActiveMQDestination());
LOG.debug("Ignoring dlq request for: {}, RedeliveryPolicy not found (and no fallback) for: {}", messageReference.getMessageId(), regionDestination.getActiveMQDestination());
}
return false;
@ -169,8 +169,9 @@ public class RedeliveryPlugin extends BrokerPluginSupport {
private void scheduleRedelivery(ConnectionContext context, MessageReference messageReference, long delay, int redeliveryCount) throws Exception {
if (LOG.isTraceEnabled()) {
Destination regionDestination = (Destination) messageReference.getRegionDestination();
LOG.trace("redelivery #" + redeliveryCount + " of: " + messageReference.getMessageId() + " with delay: "
+ delay + ", dest: " + regionDestination.getActiveMQDestination());
LOG.trace("redelivery #{} of: {} with delay: {}, dest: {}", new Object[]{
redeliveryCount, messageReference.getMessageId(), delay, regionDestination.getActiveMQDestination()
});
}
final Message old = messageReference.getMessage();
Message message = old.copy();

View File

@ -125,9 +125,7 @@ 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);
}
LOG.debug("Set message {} timestamp from {} to {}", new Object[]{ message.getMessageId(), oldTimestamp, newTimeStamp });
}
}
super.send(producerExchange, message);

View File

@ -61,7 +61,7 @@ public class TraceBrokerPathPlugin extends BrokerPluginSupport {
messageDispatch.getMessage().setMarshalledProperties(null);
}
} catch (IOException ioe) {
LOG.warn("Setting broker property failed " + ioe, ioe);
LOG.warn("Setting broker property failed", ioe);
}
super.preProcessDispatch(messageDispatch);
}

View File

@ -125,7 +125,7 @@ public class UDPTraceBrokerPlugin extends BrokerPluginSupport {
socket.send(datagram);
} catch (Throwable e) {
LOG.debug("Failed to trace: " + command, e);
LOG.debug("Failed to trace: {}", command, e);
}
}

View File

@ -40,9 +40,7 @@ public abstract class DotFileInterceptorSupport extends BrokerFilter {
}
protected void generateFile() throws Exception {
if (log.isDebugEnabled()) {
log.debug("Creating DOT file at: " + file);
}
log.debug("Creating DOT file at: {}", file);
PrintWriter writer = new PrintWriter(new FileWriter(file));
try {
generateFile(writer);

View File

@ -30,14 +30,11 @@ import org.apache.activemq.command.ActiveMQTempQueue;
import org.apache.activemq.command.ActiveMQTempTopic;
import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.util.LRUCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A view into the running Broker
*/
public class MessageBrokerView {
private static final Logger LOG = LoggerFactory.getLogger(MessageBrokerView.class);
private final BrokerService brokerService;
private Map<ActiveMQDestination,BrokerDestinationView> destinationViewMap = new LRUCache<ActiveMQDestination, BrokerDestinationView>();

View File

@ -21,12 +21,9 @@ import java.util.Map;
import org.apache.activemq.broker.BrokerRegistry;
import org.apache.activemq.broker.BrokerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MessageBrokerViewRegistry {
private static final Logger LOG = LoggerFactory.getLogger(BrokerRegistry.class);
private static final MessageBrokerViewRegistry INSTANCE = new MessageBrokerViewRegistry();
private final Object mutex = new Object();

View File

@ -53,7 +53,7 @@ public class CacheEvictionUsageListener implements UsageListener {
boolean evictMessages() {
// Try to take the memory usage down below the low mark.
LOG.debug("Evicting cache memory usage: " + usage.getPercentUsage());
LOG.debug("Evicting cache memory usage: {}", usage.getPercentUsage());
List<CacheEvictor> list = new LinkedList<CacheEvictor>(evictors);
while (list.size() > 0 && usage.getPercentUsage() > usageLowMark) {

View File

@ -24,8 +24,6 @@ import org.apache.activemq.broker.region.MessageReference;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.Message;
import org.apache.activemq.filter.DestinationFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A simple fixed size {@link MessageList} where there is a single, fixed size
@ -36,7 +34,6 @@ import org.slf4j.LoggerFactory;
*
*/
public class SimpleMessageList implements MessageList {
private static final Logger LOG = LoggerFactory.getLogger(SimpleMessageList.class);
private final LinkedList<MessageReference> list = new LinkedList<MessageReference>();
private int maximumSize = 100 * 64 * 1024;
private int size;

View File

@ -106,15 +106,10 @@ public class ConditionalNetworkBridgeFilterFactory implements NetworkBridgeFilte
// potential replay back to origin
match = allowReplayWhenNoConsumers && hasNoLocalConsumers(message, mec) && hasNotJustArrived(message);
if (LOG.isTraceEnabled()) {
if (match) {
LOG.trace("Replaying [" + message.getMessageId() + "] for [" + message.getDestination()
+ "] back to origin in the absence of a local consumer");
LOG.trace("Replaying [{}] for [{}] back to origin in the absence of a local consumer", message.getMessageId(), message.getDestination());
} else {
LOG.trace("Suppressing replay of [" + message.getMessageId() + "] for [" + message.getDestination()
+ "] back to origin " + Arrays.asList(message.getBrokerPath()));
}
LOG.trace("Suppressing replay of [{}] for [{}] back to origin {}", new Object[]{ message.getMessageId(), message.getDestination(), Arrays.asList(message.getBrokerPath())} );
}
} else {
@ -123,10 +118,9 @@ public class ConditionalNetworkBridgeFilterFactory implements NetworkBridgeFilte
}
if (match && rateLimitExceeded()) {
if (LOG.isTraceEnabled()) {
LOG.trace("Throttled network consumer rejecting [" + message.getMessageId() + "] for [" + message.getDestination() + " " + matchCount
+ ">" + rateLimit + "/" + rateDuration);
}
LOG.trace("Throttled network consumer rejecting [{}] for [{}] {}>{}/{}", new Object[]{
message.getMessageId(), message.getDestination(), matchCount, rateLimit, rateDuration
});
match = false;
}
@ -142,10 +136,9 @@ public class ConditionalNetworkBridgeFilterFactory implements NetworkBridgeFilte
List<Subscription> consumers = regionDestination.getConsumers();
for (Subscription sub : consumers) {
if (!sub.getConsumerInfo().isNetworkSubscription() && !sub.getConsumerInfo().isBrowser()) {
if (LOG.isTraceEnabled()) {
LOG.trace("Not replaying [" + message.getMessageId() + "] for [" + message.getDestination()
+ "] to origin due to existing local consumer: " + sub.getConsumerInfo());
}
LOG.trace("Not replaying [{}] for [{}] to origin due to existing local consumer: {}", new Object[]{
message.getMessageId(), message.getDestination(), sub.getConsumerInfo()
});
return false;
}
}

View File

@ -18,10 +18,8 @@ package org.apache.activemq.network;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.activemq.command.BrokerId;
import org.apache.activemq.command.ConsumerId;
import org.apache.activemq.command.ConsumerInfo;
import org.apache.activemq.command.SubscriptionInfo;
@ -67,9 +65,9 @@ public class ConduitBridge extends DemandForwardingBridge {
for (DemandSubscription ds : subscriptionMapByLocalId.values()) {
DestinationFilter filter = DestinationFilter.parseFilter(ds.getLocalInfo().getDestination());
if (!ds.getRemoteInfo().isNetworkSubscription() && filter.matches(info.getDestination())) {
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " " + info + " with ids" + info.getNetworkConsumerIds() + " matched (add interest) " + ds);
}
LOG.debug("{} {} with ids {} matched (add interest) {}", new Object[]{
configuration.getBrokerName(), info, info.getNetworkConsumerIds(), ds
});
// add the interest in the subscription
if (!info.isDurable()) {
ds.add(info.getConsumerId());
@ -89,9 +87,9 @@ public class ConduitBridge extends DemandForwardingBridge {
for (DemandSubscription ds : subscriptionMapByLocalId.values()) {
if (ds.remove(id)) {
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " on " + localBroker + " from " + remoteBrokerName + " removed interest for: " + id + " from " + ds);
}
LOG.debug("{} on {} from {} removed interest for: {} from {}", new Object[]{
configuration.getBrokerName(), localBroker, remoteBrokerName, id, ds
});
}
if (ds.isEmpty()) {
tmpList.add(ds);
@ -100,9 +98,9 @@ public class ConduitBridge extends DemandForwardingBridge {
for (DemandSubscription ds : tmpList) {
removeSubscription(ds);
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " on " + localBroker + " from " + remoteBrokerName + " removed " + ds);
}
LOG.debug("{} on {} from {} removed {}", new Object[]{
configuration.getBrokerName(), localBroker, remoteBrokerName, ds
});
}
}
}

View File

@ -221,9 +221,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
public void stop() throws Exception {
if (started.compareAndSet(true, false)) {
if (disposed.compareAndSet(false, true)) {
if (LOG.isDebugEnabled()) {
LOG.debug(" stopping " + configuration.getBrokerName() + " bridge to " + remoteBrokerName);
}
LOG.debug(" stopping {} bridge to {}", configuration.getBrokerName(), remoteBrokerName);
futureRemoteBrokerInfo.cancel(true);
futureLocalBrokerInfo.cancel(true);
@ -235,9 +233,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
try {
// local start complete
if (startedLatch.getCount() < 2) {
if (LOG.isTraceEnabled()) {
LOG.trace(configuration.getBrokerName() + " unregister bridge (" + this + ") to " + remoteBrokerName);
}
LOG.trace("{} unregister bridge ({}) to {}", new Object[]{
configuration.getBrokerName(), this, remoteBrokerName
});
brokerService.getBroker().removeBroker(null, remoteBrokerInfo);
brokerService.getBroker().networkBridgeStopped(remoteBrokerInfo);
}
@ -252,16 +250,12 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
serialExecutor.shutdown();
if (!serialExecutor.awaitTermination(5, TimeUnit.SECONDS)) {
List<Runnable> pendingTasks = serialExecutor.shutdownNow();
if (LOG.isInfoEnabled()) {
LOG.info("pending tasks on stop" + pendingTasks);
}
LOG.info("pending tasks on stop {}", pendingTasks);
}
localBroker.oneway(new ShutdownInfo());
remoteBroker.oneway(new ShutdownInfo());
} catch (Throwable e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Caught exception sending shutdown", e);
}
} finally {
sendShutdown.countDown();
}
@ -287,9 +281,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
}
}
if (LOG.isInfoEnabled()) {
LOG.info(configuration.getBrokerName() + " bridge to " + remoteBrokerName + " stopped");
}
LOG.info("{} bridge to {} stopped", configuration.getBrokerName(), remoteBrokerName);
}
}
@ -339,11 +331,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
// and if so just stop now before registering anything.
remoteBrokerId = remoteBrokerInfo.getBrokerId();
if (localBrokerId.equals(remoteBrokerId)) {
if (LOG.isTraceEnabled()) {
LOG.trace(configuration.getBrokerName() +
" disconnecting remote loop back connection for: " +
remoteBrokerName + ", with id:" + remoteBrokerId);
}
LOG.trace("{} disconnecting remote loop back connector for: {}, with id: {}", new Object[]{
configuration.getBrokerName(), remoteBrokerName, remoteBrokerId
});
ServiceSupport.dispose(localBroker);
ServiceSupport.dispose(remoteBroker);
// the bridge is left in a bit of limbo, but it won't get retried
@ -389,7 +379,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
new ActiveMQDestination[configuration.getDynamicallyIncludedDestinations().size()]);
}
} catch (Throwable t) {
LOG.error("Error mapping remote configuration: " + props, t);
LOG.error("Error mapping remote configuration: {}", props, t);
}
}
@ -410,9 +400,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
private void startLocalBridge() throws Throwable {
if (localBridgeStarted.compareAndSet(false, true)) {
synchronized (this) {
if (LOG.isTraceEnabled()) {
LOG.trace(configuration.getBrokerName() + " starting local Bridge, localBroker=" + localBroker);
}
LOG.trace("{} starting local Bridge, localBroker={}", configuration.getBrokerName(), localBroker);
if (!disposed.get()) {
localConnectionInfo = new ConnectionInfo();
localConnectionInfo.setConnectionId(new ConnectionId(idGenerator.generateId()));
@ -471,12 +459,12 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
// new peer broker (a consumer can work with remote broker also)
brokerService.getBroker().addBroker(null, remoteBrokerInfo);
if (LOG.isInfoEnabled()) {
LOG.info("Network connection between " + localBroker + " and " + remoteBroker + "(" + remoteBrokerName + ") has been established.");
if (LOG.isTraceEnabled()) {
LOG.trace(configuration.getBrokerName() + " register bridge (" + this + ") to " + remoteBrokerName);
}
}
LOG.info("Network connection between {} and {} ({}) has been established.", new Object[]{
localBroker, remoteBroker, remoteBrokerName
});
LOG.trace("{} register bridge ({}) to {}", new Object[]{
configuration.getBrokerName(), this, remoteBrokerName
});
} else {
LOG.warn("Bridge was disposed before the startLocalBridge() method was fully executed.");
}
@ -487,17 +475,16 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
if (!disposed.get()) {
setupStaticDestinations();
} else {
LOG.warn("Network connection between " + localBroker + " and " + remoteBroker + "(" + remoteBrokerName
+ ") was interrupted during establishment.");
LOG.warn("Network connection between {} and {} ({}) was interrupted during establishment.", new Object[]{
localBroker, remoteBroker, remoteBrokerName
});
}
}
}
protected void startRemoteBridge() throws Exception {
if (remoteBridgeStarted.compareAndSet(false, true)) {
if (LOG.isTraceEnabled()) {
LOG.trace(configuration.getBrokerName() + " starting remote Bridge, remoteBroker=" + remoteBroker);
}
LOG.trace("{} starting remote Bridge, remoteBroker={}", configuration.getBrokerName(), remoteBroker);
synchronized (this) {
if (!isCreatedByDuplex()) {
BrokerInfo brokerInfo = new BrokerInfo();
@ -552,11 +539,15 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
public void serviceRemoteException(Throwable error) {
if (!disposed.get()) {
if (error instanceof SecurityException || error instanceof GeneralSecurityException) {
LOG.error("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a remote error: " + error);
LOG.error("Network connection between {} and {} shutdown due to a remote error: {}", new Object[]{
localBroker, remoteBroker, error
});
} else {
LOG.warn("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a remote error: " + error);
LOG.warn("Network connection between {} and {} shutdown due to a remote error: {}", new Object[]{
localBroker, remoteBroker, error
});
}
LOG.debug("The remote Exception was: " + error, error);
LOG.debug("The remote Exception was: {}", error, error);
brokerService.getTaskRunnerFactory().execute(new Runnable() {
@Override
public void run() {
@ -582,9 +573,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
serviceRemoteException(ce.getException());
} else {
if (isDuplex()) {
if (LOG.isTraceEnabled()) {
LOG.trace(configuration.getBrokerName() + " duplex command type: " + command.getDataStructureType());
}
LOG.trace("{} duplex command type: {}", configuration.getBrokerName(), command.getDataStructureType());
if (command.isMessage()) {
final ActiveMQMessage message = (ActiveMQMessage) command;
if (AdvisorySupport.isConsumerAdvisoryTopic(message.getDestination())
@ -609,7 +598,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
reply.setCorrelationId(correlationId);
remoteBroker.oneway(reply);
} catch (IOException error) {
LOG.error("Exception: " + error + " on duplex forward of: " + message);
LOG.error("Exception: {} on duplex forward of: {}", error, message);
serviceRemoteException(error);
}
}
@ -634,7 +623,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
ack.setConsumerId(localSub.getLocalInfo().getConsumerId());
localBroker.oneway(ack);
} else {
LOG.warn("Matching local subscription not found for ack: " + ack);
LOG.warn("Matching local subscription not found for ack: {}", ack);
}
break;
case ConsumerInfo.DATA_STRUCTURE_TYPE:
@ -643,7 +632,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
addConsumerInfo((ConsumerInfo) command);
} else {
// received a subscription whilst stopping
LOG.warn("Stopping - ignoring ConsumerInfo: " + command);
LOG.warn("Stopping - ignoring ConsumerInfo: {}", command);
}
break;
case ShutdownInfo.DATA_STRUCTURE_TYPE:
@ -653,9 +642,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
serviceRemoteException(new IOException(command.toString()));
break;
default:
if (LOG.isDebugEnabled()) {
LOG.debug("Ignoring remote command: " + command);
}
LOG.debug("Ignoring remote command: {}", command);
}
}
} else {
@ -665,14 +652,12 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
case ShutdownInfo.DATA_STRUCTURE_TYPE:
break;
default:
LOG.warn("Unexpected remote command: " + command);
LOG.warn("Unexpected remote command: {}", command);
}
}
}
} catch (Throwable e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Exception processing remote command: " + command, e);
}
LOG.debug("Exception processing remote command: {}", command, e);
serviceRemoteException(e);
}
}
@ -696,34 +681,30 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
BrokerId[] path = info.getBrokerPath();
if (info.isBrowser()) {
if (LOG.isDebugEnabled()) {
LOG.info(configuration.getBrokerName() + " Ignoring sub from " + remoteBrokerName + ", browsers explicitly suppressed");
}
LOG.info("{} Ignoring sub from {}, browsers explicitly suppressed", configuration.getBrokerName(), remoteBrokerName);
return;
}
if (path != null && networkTTL > -1 && path.length >= networkTTL) {
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " Ignoring sub from " + remoteBrokerName + ", restricted to " + networkTTL
+ " network hops only : " + info);
}
LOG.debug("{} Ignoring sub from {}, restricted to {} network hops only: {}", new Object[]{
configuration.getBrokerName(), remoteBrokerName, networkTTL, info
});
return;
}
if (contains(path, localBrokerPath[0])) {
// Ignore this consumer as it's a consumer we locally sent to the broker.
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " Ignoring sub from " + remoteBrokerName + ", already routed through this broker once : " + info);
}
LOG.debug("{} Ignoring sub from {}, already routed through this broker once: {}", new Object[]{
configuration.getBrokerName(), remoteBrokerName, info
});
return;
}
if (!isPermissableDestination(info.getDestination())) {
// ignore if not in the permitted or in the excluded list
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " Ignoring sub from " + remoteBrokerName + ", destination " + info.getDestination()
+ " is not permiited :" + info);
}
LOG.debug("{} Ignoring sub from {}, destination {} is not permitted: {}", new Object[]{
configuration.getBrokerName(), remoteBrokerName, info.getDestination(), info
});
return;
}
@ -737,15 +718,13 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
final DestinationInfo destInfo = (DestinationInfo) data;
BrokerId[] path = destInfo.getBrokerPath();
if (path != null && networkTTL > -1 && path.length >= networkTTL) {
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " Ignoring destination " + destInfo + " restricted to " + networkTTL + " network hops only");
}
LOG.debug("{} Ignoring destination {} restricted to {} network hops only", new Object[]{
configuration.getBrokerName(), destInfo, networkTTL
});
return;
}
if (contains(destInfo.getBrokerPath(), localBrokerPath[0])) {
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " Ignoring destination " + destInfo + " already routed through this broker once");
}
LOG.debug("{} Ignoring destination {} already routed through this broker once", configuration.getBrokerName(), destInfo);
return;
}
destInfo.setConnectionId(localConnectionInfo.getConnectionId());
@ -755,10 +734,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
tempDest.setConnectionId(localSessionInfo.getSessionId().getConnectionId());
}
destInfo.setBrokerPath(appendToBrokerPath(destInfo.getBrokerPath(), getRemoteBrokerPath()));
if (LOG.isTraceEnabled()) {
LOG.trace(configuration.getBrokerName() + " bridging " + (destInfo.isAddOperation() ? "add" : "remove") + " destination on " + localBroker
+ " from " + remoteBrokerName + ", destination: " + destInfo);
}
LOG.trace("{} bridging {} destination on {} from {}, destination: {}", new Object[]{
configuration.getBrokerName(), (destInfo.isAddOperation() ? "add" : "remove"), localBroker, remoteBrokerName, destInfo
});
if (destInfo.isRemoveOperation()) {
// Serialize with removeSub operations such that all removeSub advisories
// are generated
@ -768,7 +746,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
try {
localBroker.oneway(destInfo);
} catch (IOException e) {
LOG.warn("failed to deliver remove command for destination:" + destInfo.getDestination(), e);
LOG.warn("failed to deliver remove command for destination: {}", destInfo.getDestination(), e);
}
}
});
@ -815,27 +793,23 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
// not a reason to terminate the bridge - temps can disappear with
// pending sends as the demand sub may outlive the remote dest
if (messageDispatch != null) {
LOG.warn("PoisonAck of " + messageDispatch.getMessage().getMessageId() + " on forwarding error: " + error);
LOG.warn("PoisonAck of {} on forwarding error: {}", messageDispatch.getMessage().getMessageId(), error);
try {
MessageAck poisonAck = new MessageAck(messageDispatch, MessageAck.POSION_ACK_TYPE, 1);
poisonAck.setPoisonCause(error);
localBroker.oneway(poisonAck);
} catch (IOException ioe) {
LOG.error("Failed to posion ack message following forward failure: " + ioe, ioe);
LOG.error("Failed to posion ack message following forward failure: ", ioe);
}
fireFailedForwardAdvisory(messageDispatch, error);
} else {
LOG.warn("Ignoring exception on forwarding to non existent temp dest: " + error, error);
LOG.warn("Ignoring exception on forwarding to non existent temp dest: ", error);
}
return;
}
if (LOG.isInfoEnabled()) {
LOG.info("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a local error: " + error);
}
if (LOG.isDebugEnabled()) {
LOG.debug("The local Exception was:" + error, error);
}
LOG.info("Network connection between {} and {} shutdown due to a local error: {}", new Object[]{ localBroker, remoteBroker, error });
LOG.debug("The local Exception was: {}", error, error);
brokerService.getTaskRunnerFactory().execute(new Runnable() {
@Override
@ -865,13 +839,11 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
}
} catch (Exception e) {
LOG.warn("failed to fire forward failure advisory, cause: " + e);
if (LOG.isDebugEnabled()) {
LOG.warn("failed to fire forward failure advisory, cause: {}", e);
LOG.debug("detail", e);
}
}
}
}
protected Service getControllingService() {
return duplexInitiatingConnection != null ? duplexInitiatingConnection : DemandForwardingBridgeSupport.this;
@ -890,10 +862,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
protected void removeSubscription(final DemandSubscription sub) throws IOException {
if (sub != null) {
if (LOG.isTraceEnabled()) {
LOG.trace(configuration.getBrokerName() + " remove local subscription:" + sub.getLocalInfo().getConsumerId() + " for remote "
+ sub.getRemoteInfo().getConsumerId());
}
LOG.trace("{} remove local subscription: {} for remote {}", new Object[]{ configuration.getBrokerName(), sub.getLocalInfo().getConsumerId(), sub.getRemoteInfo().getConsumerId() });
// ensure not available for conduit subs pending removal
subscriptionMapByLocalId.remove(sub.getLocalInfo().getConsumerId());
@ -909,7 +878,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
try {
localBroker.oneway(sub.getLocalInfo().createRemoveCommand());
} catch (IOException e) {
LOG.warn("failed to deliver remove command for local subscription, for remote " + sub.getRemoteInfo().getConsumerId(), e);
LOG.warn("failed to deliver remove command for local subscription, for remote {}", sub.getRemoteInfo().getConsumerId(), e);
}
}
});
@ -944,11 +913,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
if (sub != null && md.getMessage() != null && sub.incrementOutstandingResponses()) {
if (suppressMessageDispatch(md, sub)) {
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " message not forwarded to " + remoteBrokerName
+ " because message came from there or fails TTL, brokerPath: " + Arrays.toString(md.getMessage().getBrokerPath())
+ ", message: " + md.getMessage());
}
LOG.debug("{} message not forwarded to {} because message came from there or fails TTL, brokerPath: {}, message: {}", new Object[]{
configuration.getBrokerName(), remoteBrokerName, Arrays.toString(md.getMessage().getBrokerPath()), md.getMessage()
});
// still ack as it may be durable
try {
localBroker.oneway(new MessageAck(md, MessageAck.INDIVIDUAL_ACK_TYPE, 1));
@ -959,11 +926,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
}
Message message = configureMessage(md);
if (LOG.isDebugEnabled()) {
LOG.debug("bridging (" + configuration.getBrokerName() + " -> " + remoteBrokerName + ") "
+ (LOG.isTraceEnabled() ? message : message.getMessageId()) + ", consumer: " + md.getConsumerId() + ", destination "
+ message.getDestination() + ", brokerPath: " + Arrays.toString(message.getBrokerPath()) + ", message: " + message);
}
LOG.debug("bridging ({} -> {}), consumer: {}, destinaition: {}, brokerPath: {}, message: {}", new Object[]{
configuration.getBrokerName(), remoteBrokerName, (LOG.isTraceEnabled() ? message : message.getMessageId()), md.getConsumerId(), message.getDestination(), Arrays.toString(message.getBrokerPath()), message
});
if (isDuplex() && AdvisorySupport.ADIVSORY_MESSAGE_TYPE.equals(message.getType())) {
try {
@ -1013,15 +978,12 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
}
}
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("No subscription registered with this network bridge for consumerId " + md.getConsumerId() + " for message: "
+ md.getMessage());
}
LOG.debug("No subscription registered with this network bridge for consumerId: {} for message: {}", md.getConsumerId(), md.getMessage());
}
} else if (command.isBrokerInfo()) {
futureLocalBrokerInfo.set((BrokerInfo) command);
} else if (command.isShutdownInfo()) {
LOG.info(configuration.getBrokerName() + " Shutting down");
LOG.info("{} Shutting down", configuration.getBrokerName());
stop();
} else if (command.getClass() == ConnectionError.class) {
ConnectionError ce = (ConnectionError) command;
@ -1031,7 +993,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
case WireFormatInfo.DATA_STRUCTURE_TYPE:
break;
default:
LOG.warn("Unexpected local command: " + command);
LOG.warn("Unexpected local command: {}", command);
}
}
} catch (Throwable e) {
@ -1144,11 +1106,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
try {
addSubscription(sub);
} catch (IOException e) {
LOG.error("Failed to add static destination " + dest, e);
}
if (LOG.isTraceEnabled()) {
LOG.trace(configuration.getBrokerName() + ", bridging messages for static destination: " + dest);
LOG.error("Failed to add static destination {}", dest, e);
}
LOG.trace("{}, bridging messages for static destination: {}", configuration.getBrokerName(), dest);
}
}
}
@ -1165,7 +1125,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
sub.getDurableRemoteSubs().add(new SubscriptionInfo(sub.getRemoteInfo().getClientId(), consumerInfo.getSubscriptionName()));
}
addSubscription(sub);
LOG.debug(configuration.getBrokerName() + " new demand subscription: " + sub);
LOG.debug("{} new demand subscription: {}", configuration.getBrokerName(), sub);
}
}
}
@ -1215,24 +1175,20 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
boolean suppress = false;
if (existingSub.getConsumerInfo().getPriority() >= candidateInfo.getPriority()) {
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " Ignoring duplicate subscription from " + remoteBrokerName + ", sub: " + candidateInfo
+ " is duplicated by network subscription with equal or higher network priority: " + existingSub + ", networkConsumerIds: "
+ existingSub.getConsumerInfo().getNetworkConsumerIds());
}
LOG.debug("{} Ignoring duplicate subscription from {}, sub: {} is duplicate by network subscription with equal or higher network priority: {}, networkConsumerIds: {}", new Object[]{
configuration.getBrokerName(), remoteBrokerName, candidateInfo, existingSub, existingSub.getConsumerInfo().getNetworkConsumerIds()
});
suppress = true;
} else {
// remove the existing lower priority duplicate and allow this candidate
try {
removeDuplicateSubscription(existingSub);
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " Replacing duplicate subscription " + existingSub.getConsumerInfo() + " with sub from "
+ remoteBrokerName + ", which has a higher priority, new sub: " + candidateInfo + ", networkComsumerIds: "
+ candidateInfo.getNetworkConsumerIds());
}
LOG.debug("{} Replacing duplicate subscription {} with sub from {}, which has a higher priority, new sub: {}, networkConsumerIds: {}", new Object[]{
configuration.getBrokerName(), existingSub.getConsumerInfo(), remoteBrokerName, candidateInfo, candidateInfo.getNetworkConsumerIds()
});
} catch (IOException e) {
LOG.error("Failed to remove duplicated sub as a result of sub with higher priority, sub: " + existingSub, e);
LOG.error("Failed to remove duplicated sub as a result of sub with higher priority, sub: {}", existingSub, e);
}
}
return suppress;
@ -1309,9 +1265,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
priority -= info.getBrokerPath().length + 1;
}
result.getLocalInfo().setPriority(priority);
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " using priority :" + priority + " for subscription: " + info);
}
LOG.debug("{} using priority: {} for subscription: {}", new Object[]{ configuration.getBrokerName(), priority, info });
}
configureDemandSubscription(info, result);
return result;
@ -1359,15 +1313,14 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
protected void removeDemandSubscription(ConsumerId id) throws IOException {
DemandSubscription sub = subscriptionMapByRemoteId.remove(id);
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " remove request on " + localBroker + " from " + remoteBrokerName + " , consumer id: " + id
+ ", matching sub: " + sub);
}
LOG.debug("{} remove request on {} from {}, consumer id: {}, matching sub: {}", new Object[]{
configuration.getBrokerName(), localBroker, remoteBrokerName, id, sub
});
if (sub != null) {
removeSubscription(sub);
if (LOG.isDebugEnabled()) {
LOG.debug(configuration.getBrokerName() + " removed sub on " + localBroker + " from " + remoteBrokerName + " : " + sub.getRemoteInfo());
}
LOG.debug("{} removed sub on {} from {}: {}", new Object[]{
configuration.getBrokerName(), localBroker, remoteBrokerName, sub.getRemoteInfo()
});
}
}
@ -1379,7 +1332,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
removeDemandSubscription(sub.getRemoteInfo().getConsumerId());
removeDone = true;
} catch (IOException e) {
LOG.debug("removeDemandSubscriptionByLocalId failed for localId: " + consumerId, e);
LOG.debug("removeDemandSubscriptionByLocalId failed for localId: {}", consumerId, e);
}
}
return removeDone;
@ -1618,9 +1571,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
return info;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
if (LOG.isDebugEnabled()) {
LOG.debug("Operation interupted: " + e, e);
}
LOG.debug("Operation interrupted: {}", e, e);
throw new InterruptedException("Interrupted.");
}
}

View File

@ -107,9 +107,7 @@ public class DemandSubscription {
public void waitForCompletion() {
if (dispatched.get() > 0) {
if (LOG.isDebugEnabled()) {
LOG.debug("Waiting for completion for sub: " + localInfo.getConsumerId() + ", dispatched: " + this.dispatched.get());
}
LOG.debug("Waiting for completion for sub: {}, dispatched: {}", localInfo.getConsumerId(), this.dispatched.get());
activeWaiter.set(true);
if (dispatched.get() > 0) {
synchronized (activeWaiter) {
@ -119,8 +117,7 @@ public class DemandSubscription {
}
}
if (this.dispatched.get() > 0) {
LOG.warn("demand sub interrupted or timedout while waiting for outstanding responses, " +
"expect potentially " + this.dispatched.get() + " duplicate forwards");
LOG.warn("demand sub interrupted or timedout while waiting for outstanding responses, expect potentially {} duplicate forwards", this.dispatched.get());
}
}
}

View File

@ -70,7 +70,7 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
// allow discovery agent to grab it's parameters
IntrospectionSupport.setProperties(getDiscoveryAgent(), parameters);
} catch (URISyntaxException e) {
LOG.warn("failed to parse query parameters from discoveryURI: " + discoveryURI, e);
LOG.warn("failed to parse query parameters from discoveryURI: {}", discoveryURI, e);
}
}
@ -90,29 +90,23 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
try {
uri = new URI(url);
} catch (URISyntaxException e) {
LOG.warn("Could not connect to remote URI: " + url + " due to bad URI syntax: " + e, e);
LOG.warn("Could not connect to remote URI: {} due to bad URI syntax: ", url, e);
return;
}
if (localURI.equals(uri)) {
if (LOG.isDebugEnabled()) {
LOG.debug("not connecting loopback: " + uri);
}
LOG.debug("not connecting loopback: {}", uri);
return;
}
if (connectionFilter != null && !connectionFilter.connectTo(uri)) {
if (LOG.isDebugEnabled()) {
LOG.debug("connectionFilter disallows connection to: " + uri);
}
LOG.debug("connectionFilter disallows connection to: {}", uri);
return;
}
// Should we try to connect to that URI?
if (activeEvents.putIfAbsent(uri, event) != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Discovery agent generated a duplicate onServiceAdd event for: " + uri);
}
LOG.debug("Discovery agent generated a duplicate onServiceAdd event for: {}", uri);
return;
}
@ -120,12 +114,10 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
try {
connectUri = URISupport.applyParameters(connectUri, parameters, DISCOVERED_OPTION_PREFIX);
} catch (URISyntaxException e) {
LOG.warn("could not apply query parameters: " + parameters + " to: " + connectUri, e);
LOG.warn("could not apply query parameters: {} to: {}", new Object[]{ parameters, connectUri }, e);
}
if (LOG.isInfoEnabled()) {
LOG.info("Establishing network connection from " + localURI + " to " + connectUri);
}
LOG.info("Establishing network connection from {} to {}", localURI, connectUri);
Transport remoteTransport;
Transport localTransport;
@ -135,10 +127,8 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
try {
remoteTransport = TransportFactory.connect(connectUri);
} catch (Exception e) {
LOG.warn("Could not connect to remote URI: " + connectUri + ": " + e.getMessage());
if (LOG.isDebugEnabled()) {
LOG.debug("Connection failure exception: " + e, e);
}
LOG.warn("Could not connect to remote URI: {}: {}", connectUri, e.getMessage());
LOG.debug("Connection failure exception: ", e);
activeEvents.remove(uri);
return;
}
@ -146,10 +136,8 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
localTransport = createLocalTransport();
} catch (Exception e) {
ServiceSupport.dispose(remoteTransport);
LOG.warn("Could not connect to local URI: " + localURI + ": " + e.getMessage());
if (LOG.isDebugEnabled()) {
LOG.debug("Connection failure exception: " + e, e);
}
LOG.warn("Could not connect to local URI: {}: {}", localURI, e.getMessage());
LOG.debug("Connection failure exception: ", e);
activeEvents.remove(uri);
return;
}
@ -165,17 +153,13 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
} catch (Exception e) {
ServiceSupport.dispose(localTransport);
ServiceSupport.dispose(remoteTransport);
LOG.warn("Could not start network bridge between: " + localURI + " and: " + uri + " due to: " + e);
if (LOG.isDebugEnabled()) {
LOG.debug("Start failure exception: " + e, e);
}
LOG.warn("Could not start network bridge between: {} and: {} due to: {}", new Object[]{ localURI, uri, e });
LOG.debug("Start failure exception: ", e);
try {
// Will remove bridge and active event.
discoveryAgent.serviceFailed(event);
} catch (IOException e1) {
if (LOG.isDebugEnabled()) {
LOG.debug("Discovery agent failure while handling failure event: " + e1.getMessage(), e1);
}
LOG.debug("Discovery agent failure while handling failure event: {}", e1.getMessage(), e1);
}
}
}
@ -189,7 +173,7 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
try {
uri = new URI(url);
} catch (URISyntaxException e) {
LOG.warn("Could not connect to remote URI: " + url + " due to bad URI syntax: " + e, e);
LOG.warn("Could not connect to remote URI: {} due to bad URI syntax: ", url, e);
return;
}

View File

@ -65,11 +65,9 @@ public class DurableConduitBridge extends ConduitBridge {
try {
addSubscription(sub);
} catch (IOException e) {
LOG.error("Failed to add static destination " + dest, e);
}
if (LOG.isTraceEnabled()) {
LOG.trace("Forwarding messages for durable destination: " + dest);
LOG.error("Failed to add static destination {}", dest, e);
}
LOG.trace("Forwarding messages for durable destination: {}", dest);
}
}
}

View File

@ -84,8 +84,7 @@ public class ForwardingBridge implements Service {
}
public void start() throws Exception {
LOG.info("Starting a network connection between " + localBroker + " and " + remoteBroker
+ " has been established.");
LOG.info("Starting a network connection between {} and {} has been established.", localBroker, remoteBroker);
localBroker.setTransportListener(new DefaultTransportListener() {
public void onCommand(Object o) {
@ -119,7 +118,7 @@ public class ForwardingBridge implements Service {
try {
startBridge();
} catch (IOException e) {
LOG.error("Failed to start network bridge: " + e, e);
LOG.error("Failed to start network bridge: ", e);
}
}
};
@ -162,10 +161,7 @@ public class ForwardingBridge implements Service {
localBroker.oneway(topicConsumerInfo);
}
if (LOG.isInfoEnabled()) {
LOG.info("Network connection between " + localBroker + " and " + remoteBroker
+ " has been established.");
}
LOG.info("Network connection between {} and {} has been established.", localBroker, remoteBroker);
}
public void stop() throws Exception {
@ -187,11 +183,9 @@ public class ForwardingBridge implements Service {
}
public void serviceRemoteException(Throwable error) {
LOG.info("Unexpected remote exception: " + error);
if (LOG.isDebugEnabled()) {
LOG.info("Unexpected remote exception: {}", error.getMessage());
LOG.debug("Exception trace: ", error);
}
}
protected void serviceRemoteCommand(Command command) {
try {
@ -209,7 +203,7 @@ public class ForwardingBridge implements Service {
}
}
} else {
LOG.warn("Unexpected remote command: " + command);
LOG.warn("Unexpected remote command: {}", command);
}
} catch (IOException e) {
serviceLocalException(e);
@ -217,7 +211,7 @@ public class ForwardingBridge implements Service {
}
public void serviceLocalException(Throwable error) {
LOG.info("Unexpected local exception: " + error);
LOG.info("Unexpected local exception: {}", error.getMessage());
LOG.debug("Exception trace: ", error);
fireBridgeFailed();
}
@ -315,7 +309,7 @@ public class ForwardingBridge implements Service {
}
}
} else {
LOG.debug("Unexpected local command: " + command);
LOG.debug("Unexpected local command: {}", command);
}
} catch (IOException e) {
serviceLocalException(e);

View File

@ -203,13 +203,13 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
this.ldapURI = getUri();
LOG.debug(" URI [" + this.ldapURI + "]");
LOG.debug(" URI [{}]", this.ldapURI);
env.put(Context.PROVIDER_URL, this.ldapURI.toString());
if (anonymousAuthentication) {
LOG.debug(" login credentials [anonymous]");
env.put(Context.SECURITY_AUTHENTICATION, "none");
} else {
LOG.debug(" login credentials [" + user + ":******]");
LOG.debug(" login credentials [{}:******]", user);
env.put(Context.SECURITY_PRINCIPAL, user);
env.put(Context.SECURITY_CREDENTIALS, password);
}
@ -221,7 +221,7 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
} catch (CommunicationException err) {
if (failover) {
this.ldapURI = getUri();
LOG.error("connection error [" + env.get(Context.PROVIDER_URL) + "], failover connection to [" + this.ldapURI.toString() + "]");
LOG.error("connection error [{}], failover connection to [{}]", env.get(Context.PROVIDER_URL), this.ldapURI.toString());
env.put(Context.PROVIDER_URL, this.ldapURI.toString());
Thread.sleep(curReconnectDelay);
curReconnectDelay = Math.min(curReconnectDelay * 2, maxReconnectDelay);
@ -233,9 +233,9 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
// add connectors from search results
LOG.info("searching for network connectors...");
LOG.debug(" base [" + base + "]");
LOG.debug(" filter [" + searchFilter + "]");
LOG.debug(" scope [" + searchControls.getSearchScope() + "]");
LOG.debug(" base [{}]", base);
LOG.debug(" filter [{}]", searchFilter);
LOG.debug(" scope [{}]", searchControls.getSearchScope());
NamingEnumeration<SearchResult> results = context.search(base, searchFilter, searchControls);
while (results.hasMore()) {
addConnector(results.next());
@ -278,14 +278,14 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
protected synchronized void addConnector(SearchResult result) throws Exception {
String uuid = toUUID(result);
if (uuidMap.containsKey(uuid)) {
LOG.warn("connector already regsitered for UUID [" + uuid + "]");
LOG.warn("connector already regsitered for UUID [{}]", uuid);
return;
}
URI connectorURI = toURI(result);
if (connectorMap.containsKey(connectorURI)) {
int referenceCount = referenceMap.get(connectorURI) + 1;
LOG.warn("connector reference added for URI [" + connectorURI + "], UUID [" + uuid + "], total reference(s) [" + referenceCount + "]");
LOG.warn("connector reference added for URI [{}], UUID [{}], total reference(s) [{}]", new Object[]{ connectorURI, uuid, referenceCount });
referenceMap.put(connectorURI, referenceCount);
uuidMap.put(uuid, connectorURI);
return;
@ -320,7 +320,7 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
referenceMap.put(connectorURI, 1);
uuidMap.put(uuid, connectorURI);
connector.start();
LOG.info("connector added with URI [" + connectorURI + "]");
LOG.info("connector added with URI [{}]", connectorURI);
}
/**
@ -332,20 +332,20 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
protected synchronized void removeConnector(SearchResult result) throws Exception {
String uuid = toUUID(result);
if (!uuidMap.containsKey(uuid)) {
LOG.warn("connector not regsitered for UUID [" + uuid + "]");
LOG.warn("connector not registered for UUID [{}]", uuid);
return;
}
URI connectorURI = uuidMap.get(uuid);
if (!connectorMap.containsKey(connectorURI)) {
LOG.warn("connector not regisitered for URI [" + connectorURI + "]");
LOG.warn("connector not registered for URI [{}]", connectorURI);
return;
}
int referenceCount = referenceMap.get(connectorURI) - 1;
referenceMap.put(connectorURI, referenceCount);
uuidMap.remove(uuid);
LOG.debug("connector referenced removed for URI [" + connectorURI + "], UUID [" + uuid + "], remaining reference(s) [" + referenceCount + "]");
LOG.debug("connector referenced removed for URI [{}], UUID[{}], remaining reference(s) [{}]", new Object[]{ connectorURI, uuid, referenceCount });
if (referenceCount > 0) {
return;
@ -353,7 +353,7 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
NetworkConnector connector = connectorMap.remove(connectorURI);
connector.stop();
LOG.info("connector removed with URI [" + connectorURI + "]");
LOG.info("connector removed with URI [{}]", connectorURI);
}
/**
@ -368,7 +368,7 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
String port = (String) attributes.get("ipserviceport").get();
String protocol = (String) attributes.get("ipserviceprotocol").get();
URI connectorURI = new URI("static:(" + protocol + "://" + address + ":" + port + ")");
LOG.debug("retrieved URI from SearchResult [" + connectorURI + "]");
LOG.debug("retrieved URI from SearchResult [{}]", connectorURI);
return connectorURI;
}
@ -380,7 +380,7 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
*/
protected String toUUID(SearchResult result) {
String uuid = result.getNameInNamespace();
LOG.debug("retrieved UUID from SearchResult [" + uuid + "]");
LOG.debug("retrieved UUID from SearchResult [{}]", uuid);
return uuid;
}
@ -419,7 +419,7 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
String uuidNew = event.getNewBinding().getName();
URI connectorURI = uuidMap.remove(uuidOld);
uuidMap.put(uuidNew, connectorURI);
LOG.debug("connector reference renamed for URI [" + connectorURI + "], Old UUID [" + uuidOld + "], New UUID [" + uuidNew + "]");
LOG.debug("connector reference renamed for URI [{}], Old UUID [{}], New UUID [{}]", new Object[]{ connectorURI, uuidOld, uuidNew });
}
/**

View File

@ -55,11 +55,9 @@ public class MBeanNetworkListener implements NetworkBridgeListener {
ObjectName objectName = createNetworkBridgeObjectName(bridge);
AnnotatedMBean.registerMBean(brokerService.getManagementContext(), view, objectName);
bridge.setMbeanObjectName(objectName);
if (LOG.isDebugEnabled()) {
LOG.debug("registered: " + bridge + " as: " + objectName);
}
LOG.debug("registered: {} as: {}", bridge, objectName);
} catch (Throwable e) {
LOG.debug("Network bridge could not be registered in JMX: " + e.getMessage(), e);
LOG.debug("Network bridge could not be registered in JMX: {}", e.getMessage(), e);
}
}
@ -74,7 +72,7 @@ public class MBeanNetworkListener implements NetworkBridgeListener {
brokerService.getManagementContext().unregisterMBean(objectName);
}
} catch (Throwable e) {
LOG.debug("Network bridge could not be unregistered in JMX: " + e.getMessage(), e);
LOG.debug("Network bridge could not be unregistered in JMX: {}", e.getMessage(), e);
}
}

View File

@ -19,8 +19,6 @@ package org.apache.activemq.network;
import org.apache.activemq.advisory.AdvisorySupport;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ConsumerInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@ -29,7 +27,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
* Configuration for a NetworkBridge
*/
public class NetworkBridgeConfiguration {
private static final Logger LOG = LoggerFactory.getLogger(NetworkBridgeConfiguration.class);
private boolean conduitSubscriptions = true;
private boolean dynamicOnly;

View File

@ -168,11 +168,11 @@ public abstract class NetworkConnector extends NetworkBridgeConfiguration implem
if (localURI == null) {
throw new IllegalStateException("You must configure the 'localURI' property");
}
LOG.info("Network Connector " + this + " Started");
LOG.info("Network Connector {} Started", this);
}
protected void handleStop(ServiceStopper stopper) throws Exception {
LOG.info("Network Connector " + this + " Stopped");
LOG.info("Network Connector {} Stopped", this);
}
public boolean isStarted() {
@ -212,7 +212,7 @@ public abstract class NetworkConnector extends NetworkBridgeConfiguration implem
ObjectName objectName = createNetworkBridgeObjectName(bridge);
AnnotatedMBean.registerMBean(getBrokerService().getManagementContext(), view, objectName);
} catch (Throwable e) {
LOG.debug("Network bridge could not be registered in JMX: " + e.getMessage(), e);
LOG.debug("Network bridge could not be registered in JMX: {}", e.getMessage(), e);
}
}
@ -224,7 +224,7 @@ public abstract class NetworkConnector extends NetworkBridgeConfiguration implem
ObjectName objectName = createNetworkBridgeObjectName(bridge);
getBrokerService().getManagementContext().unregisterMBean(objectName);
} catch (Throwable e) {
LOG.debug("Network bridge could not be unregistered in JMX: " + e.getMessage(), e);
LOG.debug("Network bridge could not be unregistered in JMX: {}", e.getMessage(), e);
}
}

View File

@ -146,8 +146,7 @@ public abstract class DestinationBridge implements Service, MessageListener {
return;
} catch (Exception e) {
LOG.info("failed to forward message on attempt: " + attempt +
" reason: " + e + " message: " + message, e);
LOG.info("failed to forward message on attempt: {} reason: {} message: {}", new Object[]{ attempt, e, message }, e);
}
}
}

View File

@ -89,9 +89,9 @@ public abstract class JmsConnector implements Service {
DestinationBridge bridge = (DestinationBridge)lru.getValue();
try {
bridge.stop();
LOG.info("Expired bridge: " + bridge);
LOG.info("Expired bridge: {}", bridge);
} catch (Exception e) {
LOG.warn("stopping expired bridge" + bridge + " caused an exception", e);
LOG.warn("stopping expired bridge {} caused an exception", bridge, e);
}
}
return false;
@ -160,7 +160,7 @@ public abstract class JmsConnector implements Service {
for (DestinationBridge bridge : outboundBridges) {
bridge.start();
}
LOG.info("JMS Connector " + getName() + " Started");
LOG.info("JMS Connector {} Started", getName());
}
}
@ -176,7 +176,7 @@ public abstract class JmsConnector implements Service {
for (DestinationBridge bridge : outboundBridges) {
bridge.stop();
}
LOG.info("JMS Connector " + getName() + " Stopped");
LOG.info("JMS Connector {} Stopped", getName());
}
}
@ -475,7 +475,7 @@ public abstract class JmsConnector implements Service {
return;
}
LOG.info("JmsConnector handling loss of connection [" + connection.toString() + "]");
LOG.info("JmsConnector handling loss of connection [{}]", connection.toString());
// TODO - How do we handle the re-wiring of replyToBridges in this case.
replyToBridges.clear();
@ -500,7 +500,7 @@ public abstract class JmsConnector implements Service {
try {
doInitializeConnection(false);
} catch (Exception e) {
LOG.error("Failed to initialize forgein connection for the JMSConnector", e);
LOG.error("Failed to initialize foreign connection for the JMSConnector", e);
}
}
});
@ -552,7 +552,7 @@ public abstract class JmsConnector implements Service {
try {
doInitializeConnection(false);
} catch (Exception e) {
LOG.error("Failed to initialize forgein connection for the JMSConnector", e);
LOG.error("Failed to initialize foreign connection for the JMSConnector", e);
}
}
});
@ -606,8 +606,7 @@ public abstract class JmsConnector implements Service {
return;
} catch(Exception e) {
LOG.debug("Failed to establish initial " + (local ? "local" : "foriegn") +
" connection for JmsConnector [" + attempt + "]: " + e.getMessage());
LOG.debug("Failed to establish initial {} connection for JmsConnector [{}]", new Object[]{ (local ? "local" : "foreign"), attempt }, e);
}
}
while (maxRetries < ++attempt && !connectionSerivce.isTerminating());

View File

@ -378,9 +378,9 @@ public class SimpleJmsQueueConnector extends JmsConnector {
}
bridge.setJmsConnector(this);
bridge.start();
LOG.info("Created replyTo bridge for " + replyToProducerQueue);
LOG.info("Created replyTo bridge for {}", replyToProducerQueue);
} catch (Exception e) {
LOG.error("Failed to create replyTo bridge for queue: " + replyToProducerQueue, e);
LOG.error("Failed to create replyTo bridge for queue: {}", replyToProducerQueue, e);
return null;
}
replyToBridges.put(replyToProducerQueue, bridge);
@ -409,9 +409,9 @@ public class SimpleJmsQueueConnector extends JmsConnector {
}
bridge.setJmsConnector(this);
bridge.start();
LOG.info("Created replyTo bridge for " + replyToProducerQueue);
LOG.info("Created replyTo bridge for {}", replyToProducerQueue);
} catch (Exception e) {
LOG.error("Failed to create replyTo bridge for queue: " + replyToProducerQueue, e);
LOG.error("Failed to create replyTo bridge for queue: {}", replyToProducerQueue, e);
return null;
}
replyToBridges.put(replyToProducerQueue, bridge);

View File

@ -376,9 +376,9 @@ public class SimpleJmsTopicConnector extends JmsConnector {
}
bridge.setJmsConnector(this);
bridge.start();
LOG.info("Created replyTo bridge for " + replyToProducerTopic);
LOG.info("Created replyTo bridge for {}", replyToProducerTopic);
} catch (Exception e) {
LOG.error("Failed to create replyTo bridge for topic: " + replyToProducerTopic, e);
LOG.error("Failed to create replyTo bridge for topic: {}", replyToProducerTopic, e);
return null;
}
replyToBridges.put(replyToProducerTopic, bridge);
@ -407,9 +407,9 @@ public class SimpleJmsTopicConnector extends JmsConnector {
}
bridge.setJmsConnector(this);
bridge.start();
LOG.info("Created replyTo bridge for " + replyToProducerTopic);
LOG.info("Created replyTo bridge for {}", replyToProducerTopic);
} catch (Exception e) {
LOG.error("Failed to create replyTo bridge for topic: " + replyToProducerTopic, e);
LOG.error("Failed to create replyTo bridge for topic: {}", replyToProducerTopic, e);
return null;
}
replyToBridges.put(replyToProducerTopic, bridge);

View File

@ -45,9 +45,7 @@ public class DiscardingDLQBroker extends BrokerFilter {
@Override
public boolean sendToDeadLetterQueue(ConnectionContext ctx, MessageReference msgRef, Subscription subscription, Throwable poisonCause) {
if (log.isTraceEnabled()) {
log.trace("Discarding DLQ BrokerFilter[pass through] - skipping message:" + (msgRef != null ? msgRef.getMessage() : null));
}
log.trace("Discarding DLQ BrokerFilter[pass through] - skipping message: {}", (msgRef != null ? msgRef.getMessage() : null));
boolean dropped = true;
Message msg = null;
ActiveMQDestination dest = null;
@ -78,7 +76,7 @@ public class DiscardingDLQBroker extends BrokerFilter {
if (dropped && getReportInterval() > 0) {
if ((++dropCount) % getReportInterval() == 0) {
log.info("Total of " + dropCount + " messages were discarded, since their destination was the dead letter queue");
log.info("Total of {} messages were discarded, since their destination was the dead letter queue", dropCount);
}
}
@ -95,10 +93,7 @@ public class DiscardingDLQBroker extends BrokerFilter {
}
private void skipMessage(String prefix, MessageReference msgRef) {
if (log.isDebugEnabled()) {
String lmsg = "Discarding DLQ BrokerFilter[" + prefix + "] - skipping message:" + (msgRef != null ? msgRef.getMessage() : null);
log.debug(lmsg);
}
log.debug("Discarding DLQ BrokerFilter[{}] - skipping message: {}", prefix, (msgRef != null ? msgRef.getMessage() : null));
}
public void setDropTemporaryTopics(boolean dropTemporaryTopics) {

View File

@ -26,7 +26,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Filip Hanik
* @org.apache.xbean.XBean element="discardingDLQBrokerPlugin"
* @version 1.0
*/
@ -49,10 +48,9 @@ public class DiscardingDLQBrokerPlugin implements BrokerPlugin {
* @todo Implement this org.apache.activemq.broker.BrokerPlugin method
*/
public Broker installPlugin(Broker broker) throws Exception {
log.info("Installing Discarding Dead Letter Queue broker plugin[dropAll="+isDropAll()+
"; dropTemporaryTopics="+isDropTemporaryTopics()+"; dropTemporaryQueues="+
isDropTemporaryQueues()+"; dropOnly="+getDropOnly()+"; reportInterval="+
getReportInterval()+"]");
log.info("Installing Discarding Dead Letter Queue broker plugin[dropAll={}; dropTemporaryTopics={}; dropTemporaryQueues={}; dropOnly={}; reportInterval={}]", new Object[]{
isDropAll(), isDropTemporaryTopics(), isDropTemporaryQueues(), getDropOnly(), reportInterval
});
DiscardingDLQBroker cb = new DiscardingDLQBroker(broker);
cb.setDropAll(isDropAll());
cb.setDropTemporaryQueues(isDropTemporaryQueues());

View File

@ -50,7 +50,7 @@ public ForcePersistencyModeBrokerPlugin() {
public Broker installPlugin(Broker broker) throws Exception{
ForcePersistencyModeBroker pB = new ForcePersistencyModeBroker(broker);
pB.setPersistenceFlag(isPersistenceForced());
LOG.info("Installing ForcePersistencyModeBroker plugin: persistency enforced=" + pB.isPersistent());
LOG.info("Installing ForcePersistencyModeBroker plugin: persistency enforced={}", pB.isPersistent());
return pB;
}

View File

@ -66,7 +66,7 @@ public class SubQueueSelectorCacheBroker extends BrokerFilter implements Runnabl
public SubQueueSelectorCacheBroker(Broker next, final File persistFile) {
super(next);
this.persistFile = persistFile;
LOG.info("Using persisted selector cache from[" + persistFile + "]");
LOG.info("Using persisted selector cache from[{}]", persistFile);
readCache();
@ -85,7 +85,7 @@ public class SubQueueSelectorCacheBroker extends BrokerFilter implements Runnabl
@Override
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
LOG.debug("Caching consumer selector [" + info.getSelector() + "] on a " + info.getDestination().getQualifiedName());
LOG.debug("Caching consumer selector [{}] on a {}", info.getSelector(), info.getDestination().getQualifiedName());
String selector = info.getSelector();
// As ConcurrentHashMap doesn't support null values, use always true expression
@ -141,7 +141,7 @@ public class SubQueueSelectorCacheBroker extends BrokerFilter implements Runnabl
fos.close();
} //try
} catch (IOException ex) {
LOG.error("Unable to access file[" + persistFile + "]", ex);
LOG.error("Unable to access file[{}]", persistFile, ex);
} //try
}

View File

@ -45,7 +45,7 @@ class ProxyConnection implements Service {
public void onFailure(IOException e) {
if (!shuttingDown.get()) {
LOG.debug("Transport error: " + e, e);
LOG.debug("Transport error: {}", e.getMessage(), e);
try {
stop();
} catch (Exception ignore) {

View File

@ -67,11 +67,11 @@ public class ProxyConnector implements Service {
}
public void onAcceptError(Exception error) {
LOG.error("Could not accept connection: " + error, error);
LOG.error("Could not accept connection: ", error);
}
});
getServer().start();
LOG.info("Proxy Connector " + getName() + " Started");
LOG.info("Proxy Connector {} Started", getName());
}
@ -85,7 +85,7 @@ public class ProxyConnector implements Service {
ss.stop(iter.next());
}
ss.throwFirstException();
LOG.info("Proxy Connector " + getName() + " Stopped");
LOG.info("Proxy Connector {} Stopped", getName());
}
// Properties

View File

@ -229,8 +229,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
currentContext.search(queueSearchBase, getFilterForPermissionType(permissionType),
constraints), DestinationType.QUEUE, permissionType);
} catch (Exception e) {
LOG.error("Policy not applied!. Error processing policy under '" + queueSearchBase +
"' with filter '" + getFilterForPermissionType(permissionType) + "'", e);
LOG.error("Policy not applied!. Error processing policy under '{}' with filter '{}'", new Object[]{ queueSearchBase, getFilterForPermissionType(permissionType) }, e);
}
}
@ -240,8 +239,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
currentContext.search(topicSearchBase, getFilterForPermissionType(permissionType),
constraints), DestinationType.TOPIC, permissionType);
} catch (Exception e) {
LOG.error("Policy not applied!. Error processing policy under '" + topicSearchBase +
"' with filter '" + getFilterForPermissionType(permissionType) + "'", e);
LOG.error("Policy not applied!. Error processing policy under '{}' with filter '{}'", new Object[]{ topicSearchBase, getFilterForPermissionType(permissionType) }, e);
}
}
@ -251,8 +249,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
currentContext.search(tempSearchBase, getFilterForPermissionType(permissionType),
constraints), DestinationType.TEMP, permissionType);
} catch (Exception e) {
LOG.error("Policy not applied!. Error processing policy under '" + tempSearchBase +
"' with filter '" + getFilterForPermissionType(permissionType) + "'", e);
LOG.error("Policy not applied!. Error processing policy under '{}' with filter '{}'", new Object[]{ tempSearchBase, getFilterForPermissionType(permissionType) }, e);
}
}
@ -287,7 +284,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
try {
entry = getEntry(map, new LdapName(result.getNameInNamespace()), destinationType);
} catch (Exception e) {
LOG.error("Policy not applied! Error parsing authorization policy entry under " + result.getNameInNamespace(), e);
LOG.error("Policy not applied! Error parsing authorization policy entry under {}", result.getNameInNamespace(), e);
continue;
}
@ -399,7 +396,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
try {
memberAttributes = context.getAttributes(memberDn, new String[] { "objectClass", groupNameAttribute, userNameAttribute });
} catch (NamingException e) {
LOG.error("Policy not applied! Unknown member " + memberDn + " in policy entry " + result.getNameInNamespace(), e);
LOG.error("Policy not applied! Unknown member {} in policy entry {}", new Object[]{ memberDn, result.getNameInNamespace() }, e);
continue;
}
@ -413,8 +410,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
group = true;
Attribute name = memberAttributes.get(groupNameAttribute);
if (name == null) {
LOG.error("Policy not applied! Group " + memberDn + "does not have name attribute " + groupNameAttribute + " under entry "
+ result.getNameInNamespace());
LOG.error("Policy not applied! Group {} does not have name attribute {} under entry {}", new Object[]{ memberDn, groupNameAttribute, result.getNameInNamespace() });
break;
}
@ -425,8 +421,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
user = true;
Attribute name = memberAttributes.get(userNameAttribute);
if (name == null) {
LOG.error("Policy not applied! User " + memberDn + " does not have name attribute " + userNameAttribute + " under entry "
+ result.getNameInNamespace());
LOG.error("Policy not applied! User {} does not have name attribute {} under entry {}", new Object[]{ memberDn, userNameAttribute, result.getNameInNamespace() });
break;
}
@ -440,7 +435,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
}
if ((!group && !user) || (group && user)) {
LOG.error("Policy not applied! Can't determine type of member " + memberDn + " under entry " + result.getNameInNamespace());
LOG.error("Policy not applied! Can't determine type of member {} under entry {}", memberDn, result.getNameInNamespace());
} else if (principalName != null) {
DefaultAuthorizationMap map = this.map.get();
if (group && !user) {
@ -461,7 +456,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
try {
applyAcl(entry, permissionType, members);
} catch (Exception e) {
LOG.error("Policy not applied! Error adding principals to ACL under " + result.getNameInNamespace(), e);
LOG.error("Policy not applied! Error adding principals to ACL under {}", result.getNameInNamespace(), e);
}
}
@ -695,8 +690,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
try {
query();
} catch (Exception e) {
LOG.error("Error updating authorization map. Partial policy " +
"may be applied until the next successful update.", e);
LOG.error("Error updating authorization map. Partial policy may be applied until the next successful update.", e);
}
}
}
@ -783,7 +777,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
* the permission type to which the event applies
*/
public void objectAdded(NamingEvent namingEvent, DestinationType destinationType, PermissionType permissionType) {
LOG.debug("Adding object: " + namingEvent.getNewBinding());
LOG.debug("Adding object: {}", namingEvent.getNewBinding());
SearchResult result = (SearchResult) namingEvent.getNewBinding();
try {
@ -796,9 +790,9 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
map.put(entry.getDestination(), entry);
}
} catch (InvalidNameException e) {
LOG.error("Policy not applied! Error parsing DN for addition of " + result.getName(), e);
LOG.error("Policy not applied! Error parsing DN for addition of {}", result.getName(), e);
} catch (Exception e) {
LOG.error("Policy not applied! Error processing object addition for addition of " + result.getName(), e);
LOG.error("Policy not applied! Error processing object addition for addition of {}", result.getName(), e);
}
}
@ -813,7 +807,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
* the permission type to which the event applies
*/
public void objectRemoved(NamingEvent namingEvent, DestinationType destinationType, PermissionType permissionType) {
LOG.debug("Removing object: " + namingEvent.getOldBinding());
LOG.debug("Removing object: {}", namingEvent.getOldBinding());
Binding result = namingEvent.getOldBinding();
try {
@ -822,9 +816,9 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
AuthorizationEntry entry = getEntry(map, name, destinationType);
applyAcl(entry, permissionType, new HashSet<Object>());
} catch (InvalidNameException e) {
LOG.error("Policy not applied! Error parsing DN for object removal for removal of " + result.getName(), e);
LOG.error("Policy not applied! Error parsing DN for object removal for removal of {}", result.getName(), e);
} catch (Exception e) {
LOG.error("Policy not applied! Error processing object removal for removal of " + result.getName(), e);
LOG.error("Policy not applied! Error processing object removal for removal of {}", result.getName(), e);
}
}
@ -844,7 +838,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
public void objectRenamed(NamingEvent namingEvent, DestinationType destinationType, PermissionType permissionType) {
Binding oldBinding = namingEvent.getOldBinding();
Binding newBinding = namingEvent.getNewBinding();
LOG.debug("Renaming object: " + oldBinding + " to " + newBinding);
LOG.debug("Renaming object: {} to {}", oldBinding, newBinding);
try {
LdapName oldName = new LdapName(oldBinding.getName());
@ -873,8 +867,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
}
if (!matchedToType) {
LOG.error("Policy not applied! Error processing object rename for rename of " + oldBinding.getName() + " to " + newBinding.getName()
+ ". Could not determine permission type of new object.");
LOG.error("Policy not applied! Error processing object rename for rename of {} to {}. Could not determine permission type of new object.", oldBinding.getName(), newBinding.getName());
}
} else {
// Handle the case where a destination entry is being renamed.
@ -887,14 +880,14 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
map.remove(oldDest, entry);
entries.put(newDest, entry);
} else {
LOG.warn("No authorization entry for " + oldDest);
LOG.warn("No authorization entry for {}", oldDest);
}
}
}
} catch (InvalidNameException e) {
LOG.error("Policy not applied! Error parsing DN for object rename for rename of " + oldBinding.getName() + " to " + newBinding.getName(), e);
LOG.error("Policy not applied! Error parsing DN for object rename for rename of {} to {}", new Object[]{ oldBinding.getName(), newBinding.getName() }, e);
} catch (Exception e) {
LOG.error("Policy not applied! Error processing object rename for rename of " + oldBinding.getName() + " to " + newBinding.getName(), e);
LOG.error("Policy not applied! Error processing object rename for rename of {} to {}", new Object[]{ oldBinding.getName(), newBinding.getName() }, e);
}
}
@ -909,7 +902,7 @@ public class SimpleCachedLDAPAuthorizationMap implements AuthorizationMap {
* the permission type to which the event applies
*/
public void objectChanged(NamingEvent namingEvent, DestinationType destinationType, PermissionType permissionType) {
LOG.debug("Changing object " + namingEvent.getOldBinding() + " to " + namingEvent.getNewBinding());
LOG.debug("Changing object {} to {}", namingEvent.getOldBinding(), namingEvent.getNewBinding());
objectRemoved(namingEvent, destinationType, permissionType);
objectAdded(namingEvent, destinationType, permissionType);
}

View File

@ -108,7 +108,7 @@
<scala-version>2.9.1</scala-version>
<scala-bundle-version>2.9.1_3</scala-bundle-version>
<scalatest-version>1.8</scalatest-version>
<slf4j-version>1.6.6</slf4j-version>
<slf4j-version>1.7.5</slf4j-version>
<snappy-version>1.1.0-M3</snappy-version>
<spring-version>3.2.4.RELEASE</spring-version>
<spring-osgi-version>1.2.1</spring-osgi-version>