http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java index 6adb2ab..60fa632 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java @@ -44,8 +44,12 @@ import org.apache.activemq.artemis.core.security.Role; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.SecuritySettingPlugin; import org.apache.activemq.artemis.core.settings.HierarchicalRepository; +import org.jboss.logging.Logger; public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin { + + private static final Logger logger = Logger.getLogger(LegacyLDAPSecuritySettingPlugin.class); + private static final long serialVersionUID = 4793109879399750045L; public static final String INITIAL_CONTEXT_FACTORY = "initialContextFactory"; @@ -326,17 +330,17 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin { return; } LdapName searchResultLdapName = new LdapName(searchResult.getName()); - ActiveMQServerLogger.LOGGER.debug("LDAP search result : " + searchResultLdapName); + logger.debug("LDAP search result : " + searchResultLdapName); String permissionType = null; String destination = null; String destinationType = "unknown"; for (Rdn rdn : searchResultLdapName.getRdns()) { if (rdn.getType().equals("cn")) { - ActiveMQServerLogger.LOGGER.debug("\tPermission type: " + rdn.getValue()); + logger.debug("\tPermission type: " + rdn.getValue()); permissionType = rdn.getValue().toString(); } if (rdn.getType().equals("uid")) { - ActiveMQServerLogger.LOGGER.debug("\tDestination name: " + rdn.getValue()); + logger.debug("\tDestination name: " + rdn.getValue()); destination = rdn.getValue().toString(); } if (rdn.getType().equals("ou")) { @@ -347,10 +351,10 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin { else if (rawDestinationType.toLowerCase().contains("topic")) { destinationType = "topic"; } - ActiveMQServerLogger.LOGGER.debug("\tDestination type: " + destinationType); + logger.debug("\tDestination type: " + destinationType); } } - ActiveMQServerLogger.LOGGER.debug("\tAttributes: " + attrs); + logger.debug("\tAttributes: " + attrs); Attribute attr = attrs.get(roleAttribute); NamingEnumeration<?> e = attr.getAll(); Set<Role> roles = securityRoles.get(destination); @@ -367,7 +371,7 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin { LdapName ldapname = new LdapName(value); Rdn rdn = ldapname.getRdn(ldapname.size() - 1); String roleName = rdn.getValue().toString(); - ActiveMQServerLogger.LOGGER.debug("\tRole name: " + roleName); + logger.debug("\tRole name: " + roleName); Role role = new Role(roleName, permissionType.equalsIgnoreCase(writePermissionValue), permissionType.equalsIgnoreCase(readPermissionValue), @@ -448,7 +452,7 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin { for (Rdn rdn : ldapName.getRdns()) { if (rdn.getValue().equals(writePermissionValue)) { - ActiveMQServerLogger.LOGGER.debug("Removing write permission"); + logger.debug("Removing write permission"); for (Role role : roles) { if (role.isSend()) { rolesToRemove.add(role); @@ -456,7 +460,7 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin { } } else if (rdn.getValue().equals(readPermissionValue)) { - ActiveMQServerLogger.LOGGER.debug("Removing read permission"); + logger.debug("Removing read permission"); for (Role role : roles) { if (role.isConsume()) { rolesToRemove.add(role); @@ -464,7 +468,7 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin { } } else if (rdn.getValue().equals(adminPermissionValue)) { - ActiveMQServerLogger.LOGGER.debug("Removing admin permission"); + logger.debug("Removing admin permission"); for (Role role : roles) { if (role.isCreateDurableQueue() || role.isCreateNonDurableQueue() || role.isDeleteDurableQueue() || role.isDeleteNonDurableQueue()) { rolesToRemove.add(role);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LiveOnlyActivation.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LiveOnlyActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LiveOnlyActivation.java index 6811369..de7f598 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LiveOnlyActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LiveOnlyActivation.java @@ -16,6 +16,11 @@ */ package org.apache.activemq.artemis.core.server.impl; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentMap; + import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Pair; import org.apache.activemq.artemis.api.core.SimpleString; @@ -31,13 +36,10 @@ import org.apache.activemq.artemis.core.server.LiveNodeLocator; import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory; import org.apache.activemq.artemis.core.server.cluster.ha.LiveOnlyPolicy; import org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentMap; +import org.jboss.logging.Logger; public class LiveOnlyActivation extends Activation { + private static final Logger logger = Logger.getLogger(LiveOnlyActivation.class); //this is how we act when we initially start as live private LiveOnlyPolicy liveOnlyPolicy; @@ -136,7 +138,7 @@ public class LiveOnlyActivation extends Activation { clientSessionFactory = (ClientSessionFactoryInternal) scaleDownServerLocator.createSessionFactory(possibleLive.getA(), 0, false); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.trace("Failed to connect to " + possibleLive.getA()); + logger.trace("Failed to connect to " + possibleLive.getA()); nodeLocator.notifyRegistrationFailed(false); if (clientSessionFactory != null) { clientSessionFactory.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForScaleDown.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForScaleDown.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForScaleDown.java index 663148a..13cc3aa 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForScaleDown.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForScaleDown.java @@ -28,14 +28,16 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Pair; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.TopologyMember; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.LiveNodeLocator; +import org.jboss.logging.Logger; /** * NamedLiveNodeLocatorForScaleDown looks for a live server in the cluster with a specific scaleDownGroupName */ public class NamedLiveNodeLocatorForScaleDown extends LiveNodeLocator { + private static final Logger logger = Logger.getLogger(NamedLiveNodeLocatorForScaleDown.class); + private final Lock lock = new ReentrantLock(); private final Condition condition = lock.newCondition(); private final String scaleDownGroupName; @@ -89,8 +91,8 @@ public class NamedLiveNodeLocatorForScaleDown extends LiveNodeLocator { Pair<TransportConfiguration, TransportConfiguration> connector = new Pair<>(topologyMember.getLive(), topologyMember.getBackup()); if (topologyMember.getNodeId().equals(myNodeID)) { - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace(this + "::informing node about itself, nodeUUID=" + + if (logger.isTraceEnabled()) { + logger.trace(this + "::informing node about itself, nodeUUID=" + server.getNodeID() + ", connectorPair=" + topologyMember + ", this = " + this); } return; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java index 5c3f096..353db3a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java @@ -59,9 +59,12 @@ import org.apache.activemq.artemis.core.server.management.ManagementService; import org.apache.activemq.artemis.core.transaction.ResourceManager; import org.apache.activemq.artemis.core.transaction.Transaction; import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl; +import org.jboss.logging.Logger; public class PostOfficeJournalLoader implements JournalLoader { + private static final Logger logger = Logger.getLogger(PostOfficeJournalLoader.class); + protected final PostOffice postOffice; protected final PagingManager pagingManager; private StorageManager storageManager; @@ -354,7 +357,7 @@ public class PostOfficeJournalLoader implements JournalLoader { for (Map.Entry<Long, List<PageCountPending>> entry : perQueue.entrySet()) { for (PageCountPending record : entry.getValue()) { - ActiveMQServerLogger.LOGGER.debug("Deleting pg tempCount " + record.getID()); + logger.debug("Deleting pg tempCount " + record.getID()); storageManager.deletePendingPageCounter(txRecoverCounter.getID(), record.getID()); } @@ -363,20 +366,20 @@ public class PostOfficeJournalLoader implements JournalLoader { AtomicInteger value = countsPerQueueOnPage.get(entry.getKey()); if (value == null) { - ActiveMQServerLogger.LOGGER.debug("Page " + entry.getKey() + " wasn't open, so we will just ignore"); + logger.debug("Page " + entry.getKey() + " wasn't open, so we will just ignore"); } else { - ActiveMQServerLogger.LOGGER.debug("Replacing counter " + value.get()); + logger.debug("Replacing counter " + value.get()); counter.increment(txRecoverCounter, value.get()); } } } else { // on this case the page file didn't exist, we just remove all the records since the page is already gone - ActiveMQServerLogger.LOGGER.debug("Page " + pageId + " didn't exist on address " + address + ", so we are just removing records"); + logger.debug("Page " + pageId + " didn't exist on address " + address + ", so we are just removing records"); for (List<PageCountPending> records : perQueue.values()) { for (PageCountPending record : records) { - ActiveMQServerLogger.LOGGER.debug("Removing pending page counter " + record.getID()); + logger.debug("Removing pending page counter " + record.getID()); storageManager.deletePendingPageCounter(txRecoverCounter.getID(), record.getID()); txRecoverCounter.setContainsPersistent(); } @@ -414,7 +417,7 @@ public class PostOfficeJournalLoader implements JournalLoader { Queue queue = queues.get(queueID); if (queue == null) { - ActiveMQServerLogger.LOGGER.debug("removing pending page counter id = " + pgCount.getID() + " as queueID=" + pgCount.getID() + " no longer exists"); + logger.debug("removing pending page counter id = " + pgCount.getID() + " as queueID=" + pgCount.getID() + " no longer exists"); // this means the queue doesn't exist any longer, we will remove it from the storage storageManager.deletePendingPageCounter(txRecoverCounter.getID(), pgCount.getID()); txRecoverCounter.setContainsPersistent(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index 6f91a0a..00b7a3c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -89,6 +89,7 @@ import org.apache.activemq.artemis.utils.PriorityLinkedListImpl; import org.apache.activemq.artemis.utils.ReferenceCounter; import org.apache.activemq.artemis.utils.ReusableLatch; import org.apache.activemq.artemis.utils.TypedProperties; +import org.jboss.logging.Logger; /** * Implementation of a Queue @@ -97,7 +98,7 @@ import org.apache.activemq.artemis.utils.TypedProperties; */ public class QueueImpl implements Queue { - private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(QueueImpl.class); public static final int REDISTRIBUTOR_BATCH_SIZE = 100; @@ -470,10 +471,10 @@ public class QueueImpl implements Queue { public void run() { synchronized (QueueImpl.this) { if (groups.remove(groupIDToRemove) != null) { - ActiveMQServerLogger.LOGGER.debug("Removing group after unproposal " + groupID + " from queue " + QueueImpl.this); + logger.debug("Removing group after unproposal " + groupID + " from queue " + QueueImpl.this); } else { - ActiveMQServerLogger.LOGGER.debug("Couldn't remove Removing group " + groupIDToRemove + " after unproposal on queue " + QueueImpl.this); + logger.debug("Couldn't remove Removing group " + groupIDToRemove + " after unproposal on queue " + QueueImpl.this); } } } @@ -602,14 +603,14 @@ public class QueueImpl implements Queue { @Override public void forceDelivery() { if (pageSubscription != null && pageSubscription.isPaging()) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Force delivery scheduling depage"); + if (logger.isTraceEnabled()) { + logger.trace("Force delivery scheduling depage"); } scheduleDepage(false); } - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Force delivery deliverying async"); + if (logger.isTraceEnabled()) { + logger.trace("Force delivery deliverying async"); } deliverAsync(); @@ -700,8 +701,8 @@ public class QueueImpl implements Queue { @Override public void addConsumer(final Consumer consumer) throws Exception { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug(this + " adding consumer " + consumer); + if (logger.isDebugEnabled()) { + logger.debug(this + " adding consumer " + consumer); } synchronized (this) { @@ -1071,14 +1072,14 @@ public class QueueImpl implements Queue { @Override public void expire(final MessageReference ref) throws Exception { if (expiryAddress != null) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("moving expired reference " + ref + " to address = " + expiryAddress + " from queue=" + this.getName()); + if (logger.isTraceEnabled()) { + logger.trace("moving expired reference " + ref + " to address = " + expiryAddress + " from queue=" + this.getName()); } move(null, expiryAddress, ref, true, false); } else { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("expiry is null, just acking expired message for reference " + ref + " from queue=" + this.getName()); + if (logger.isTraceEnabled()) { + logger.trace("expiry is null, just acking expired message for reference " + ref + " from queue=" + this.getName()); } acknowledge(ref); } @@ -1335,8 +1336,8 @@ public class QueueImpl implements Queue { public synchronized boolean expireReference(final long messageID) throws Exception { if (expiryAddress != null && expiryAddress.equals(this.address)) { // check expire with itself would be silly (waste of time) - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) - ActiveMQServerLogger.LOGGER.debug("Cannot expire from " + address + " into " + expiryAddress); + if (logger.isDebugEnabled()) + logger.debug("Cannot expire from " + address + " into " + expiryAddress); return false; } @@ -1360,8 +1361,8 @@ public class QueueImpl implements Queue { public synchronized int expireReferences(final Filter filter) throws Exception { if (expiryAddress != null && expiryAddress.equals(this.address)) { // check expire with itself would be silly (waste of time) - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) - ActiveMQServerLogger.LOGGER.debug("Cannot expire from " + address + " into " + expiryAddress); + if (logger.isDebugEnabled()) + logger.debug("Cannot expire from " + address + " into " + expiryAddress); return 0; } @@ -1392,8 +1393,8 @@ public class QueueImpl implements Queue { public void expireReferences() { if (expiryAddress != null && expiryAddress.equals(this.address)) { // check expire with itself would be silly (waste of time) - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) - ActiveMQServerLogger.LOGGER.debug("Cannot expire from " + address + " into " + expiryAddress); + if (logger.isDebugEnabled()) + logger.debug("Cannot expire from " + address + " into " + expiryAddress); return; } @@ -1779,8 +1780,8 @@ public class QueueImpl implements Queue { * are no more matching or available messages. */ private void deliver() { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug(this + " doing deliver. messageReferences=" + messageReferences.size()); + if (logger.isDebugEnabled()) { + logger.debug(this + " doing deliver. messageReferences=" + messageReferences.size()); } doInternalPoll(); @@ -1807,8 +1808,8 @@ public class QueueImpl implements Queue { } if (System.currentTimeMillis() > timeout) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("delivery has been running for too long. Scheduling another delivery task now"); + if (logger.isTraceEnabled()) { + logger.trace("delivery has been running for too long. Scheduling another delivery task now"); } deliverAsync(); @@ -1864,8 +1865,8 @@ public class QueueImpl implements Queue { } else { if (checkExpired(ref)) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Reference " + ref + " being expired"); + if (logger.isTraceEnabled()) { + logger.trace("Reference " + ref + " being expired"); } holder.iter.remove(); @@ -1876,8 +1877,8 @@ public class QueueImpl implements Queue { continue; } - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Queue " + this.getName() + " is delivering reference " + ref); + if (logger.isTraceEnabled()) { + logger.trace("Queue " + this.getName() + " is delivering reference " + ref); } // If a group id is set, then this overrides the consumer chosen round-robin @@ -1930,8 +1931,8 @@ public class QueueImpl implements Queue { ActiveMQServerLogger.LOGGER.nonDeliveryHandled(); } else { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug(this + "::All the consumers were busy, giving up now"); + if (logger.isDebugEnabled()) { + logger.debug(this + "::All the consumers were busy, giving up now"); } break; } @@ -2008,8 +2009,8 @@ public class QueueImpl implements Queue { private void scheduleDepage(final boolean scheduleExpiry) { if (!depagePending) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Scheduling depage for queue " + this.getName()); + if (logger.isTraceEnabled()) { + logger.trace("Scheduling depage for queue " + this.getName()); } depagePending = true; pageSubscription.getExecutor().execute(new DepageRunner(scheduleExpiry)); @@ -2029,8 +2030,8 @@ public class QueueImpl implements Queue { long timeout = System.currentTimeMillis() + DELIVERY_TIMEOUT; - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("QueueMemorySize before depage on queue=" + this.getName() + " is " + queueMemorySize.get()); + if (logger.isTraceEnabled()) { + logger.trace("QueueMemorySize before depage on queue=" + this.getName() + " is " + queueMemorySize.get()); } this.directDeliver = false; @@ -2039,20 +2040,20 @@ public class QueueImpl implements Queue { while (timeout > System.currentTimeMillis() && needsDepage() && pageIterator.hasNext()) { depaged++; PagedReference reference = pageIterator.next(); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Depaging reference " + reference + " on queue " + this.getName()); + if (logger.isTraceEnabled()) { + logger.trace("Depaging reference " + reference + " on queue " + this.getName()); } addTail(reference, false); pageIterator.remove(); } - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { + if (logger.isDebugEnabled()) { if (depaged == 0 && queueMemorySize.get() >= maxSize) { - ActiveMQServerLogger.LOGGER.debug("Couldn't depage any message as the maxSize on the queue was achieved. " + "There are too many pending messages to be acked in reference to the page configuration"); + logger.debug("Couldn't depage any message as the maxSize on the queue was achieved. " + "There are too many pending messages to be acked in reference to the page configuration"); } - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Queue Memory Size after depage on queue=" + this.getName() + + if (logger.isDebugEnabled()) { + logger.debug("Queue Memory Size after depage on queue=" + this.getName() + " is " + queueMemorySize.get() + " with maxSize = " + @@ -2076,8 +2077,8 @@ public class QueueImpl implements Queue { private void internalAddRedistributor(final Executor executor) { // create the redistributor only once if there are no local consumers if (consumerSet.isEmpty() && redistributor == null) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("QueueImpl::Adding redistributor on queue " + this.toString()); + if (logger.isTraceEnabled()) { + logger.trace("QueueImpl::Adding redistributor on queue " + this.toString()); } redistributor = new Redistributor(this, storageManager, postOffice, executor, QueueImpl.REDISTRIBUTOR_BATCH_SIZE); @@ -2098,8 +2099,8 @@ public class QueueImpl implements Queue { ServerMessage message = reference.getMessage(); if (internalQueue) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Queue " + this.getName() + " is an internal queue, no checkRedelivery"); + if (logger.isTraceEnabled()) { + logger.trace("Queue " + this.getName() + " is an internal queue, no checkRedelivery"); } // no DLQ check on internal queues return true; @@ -2117,8 +2118,8 @@ public class QueueImpl implements Queue { // First check DLA if (maxDeliveries > 0 && deliveryCount >= maxDeliveries) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Sending reference " + reference + " to DLA = " + addressSettings.getDeadLetterAddress() + " since ref.getDeliveryCount=" + reference.getDeliveryCount() + "and maxDeliveries=" + maxDeliveries + " from queue=" + this.getName()); + if (logger.isTraceEnabled()) { + logger.trace("Sending reference " + reference + " to DLA = " + addressSettings.getDeadLetterAddress() + " since ref.getDeliveryCount=" + reference.getDeliveryCount() + "and maxDeliveries=" + maxDeliveries + " from queue=" + this.getName()); } sendToDeadLetterAddress(null, reference, addressSettings.getDeadLetterAddress()); @@ -2129,8 +2130,8 @@ public class QueueImpl implements Queue { if (!ignoreRedeliveryDelay && redeliveryDelay > 0) { redeliveryDelay = calculateRedeliveryDelay(addressSettings, deliveryCount); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Setting redeliveryDelay=" + redeliveryDelay + " on reference=" + reference); + if (logger.isTraceEnabled()) { + logger.trace("Setting redeliveryDelay=" + redeliveryDelay + " on reference=" + reference); } reference.setScheduledDeliveryTime(timeBase + redeliveryDelay); @@ -2191,7 +2192,7 @@ public class QueueImpl implements Queue { if (propName.startsWith(MessageImpl.HDR_ROUTE_TO_IDS)) { oldRouteToIDs = (byte[]) copyMessage.removeProperty(propName); final String hashcodeToString = oldRouteToIDs.toString(); // don't use Arrays.toString(..) here - ActiveMQServerLogger.LOGGER.debug("Removed property from message: " + propName + " = " + hashcodeToString + " (" + ByteBuffer.wrap(oldRouteToIDs).getLong() + ")"); + logger.debug("Removed property from message: " + propName + " = " + hashcodeToString + " (" + ByteBuffer.wrap(oldRouteToIDs).getLong() + ")"); // there should only be one of these properties so potentially save some loop iterations break; @@ -2217,7 +2218,7 @@ public class QueueImpl implements Queue { ActiveMQServerLogger.LOGGER.unableToFindTargetQueue(targetNodeID); } else { - ActiveMQServerLogger.LOGGER.debug("Routing on binding: " + targetBinding); + logger.debug("Routing on binding: " + targetBinding); targetBinding.route(copyMessage, routingContext); } } @@ -2263,7 +2264,7 @@ public class QueueImpl implements Queue { // parse the queue name of the remote queue binding to determine the node ID String temp = remoteQueueBinding.getQueue().getName().toString(); targetNodeID = temp.substring(temp.lastIndexOf(".") + 1); - ActiveMQServerLogger.LOGGER.debug("Message formerly destined for " + oldQueueName + " with ID: " + oldQueueID + " on address " + copyMessage.getAddress() + " on node " + targetNodeID); + logger.debug("Message formerly destined for " + oldQueueName + " with ID: " + oldQueueID + " on address " + copyMessage.getAddress() + " on node " + targetNodeID); // now that we have the name of the queue we need to look through all the bindings again to find the new remote queue binding for (Map.Entry<SimpleString, Binding> entry2 : postOffice.getAllBindings().entrySet()) { @@ -2276,13 +2277,13 @@ public class QueueImpl implements Queue { targetNodeID = temp.substring(temp.lastIndexOf(".") + 1); if (oldQueueName.equals(remoteQueueBinding.getRoutingName()) && targetNodeID.equals(queueSuffix.toString())) { targetBinding = remoteQueueBinding; - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Message now destined for " + remoteQueueBinding.getRoutingName() + " with ID: " + remoteQueueBinding.getRemoteQueueID() + " on address " + copyMessage.getAddress() + " on node " + targetNodeID); + if (logger.isDebugEnabled()) { + logger.debug("Message now destined for " + remoteQueueBinding.getRoutingName() + " with ID: " + remoteQueueBinding.getRemoteQueueID() + " on address " + copyMessage.getAddress() + " on node " + targetNodeID); } break; } else { - ActiveMQServerLogger.LOGGER.debug("Failed to match: " + remoteQueueBinding); + logger.debug("Failed to match: " + remoteQueueBinding); } } } @@ -2485,8 +2486,8 @@ public class QueueImpl implements Queue { private boolean checkExpired(final MessageReference reference) { try { if (reference.getMessage().isExpired()) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Reference " + reference + " is expired"); + if (logger.isTraceEnabled()) { + logger.trace("Reference " + reference + " is expired"); } reference.handled(); @@ -2863,8 +2864,8 @@ public class QueueImpl implements Queue { slowConsumerReaperFuture.cancel(false); slowConsumerReaperFuture = null; slowConsumerReaperRunnable = null; - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Cancelled slow-consumer-reaper thread for queue \"" + getName() + "\""); + if (logger.isDebugEnabled()) { + logger.debug("Cancelled slow-consumer-reaper thread for queue \"" + getName() + "\""); } } } @@ -2886,8 +2887,8 @@ public class QueueImpl implements Queue { slowConsumerReaperFuture = scheduledExecutor.scheduleWithFixedDelay(slowConsumerReaperRunnable, settings.getSlowConsumerCheckPeriod(), settings.getSlowConsumerCheckPeriod(), TimeUnit.SECONDS); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Scheduled slow-consumer-reaper thread for queue \"" + getName() + + if (logger.isDebugEnabled()) { + logger.debug("Scheduled slow-consumer-reaper thread for queue \"" + getName() + "\"; slow-consumer-check-period=" + settings.getSlowConsumerCheckPeriod() + ", slow-consumer-threshold=" + settings.getSlowConsumerThreshold() + ", slow-consumer-policy=" + settings.getSlowConsumerPolicy()); @@ -2919,16 +2920,16 @@ public class QueueImpl implements Queue { @Override public void run() { float queueRate = getRate(); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug(getAddress() + ":" + getName() + " has " + getConsumerCount() + " consumer(s) and is receiving messages at a rate of " + queueRate + " msgs/second."); + if (logger.isDebugEnabled()) { + logger.debug(getAddress() + ":" + getName() + " has " + getConsumerCount() + " consumer(s) and is receiving messages at a rate of " + queueRate + " msgs/second."); } for (Consumer consumer : getConsumers()) { if (consumer instanceof ServerConsumerImpl) { ServerConsumerImpl serverConsumer = (ServerConsumerImpl) consumer; float consumerRate = serverConsumer.getRate(); if (queueRate < threshold) { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Insufficient messages received on queue \"" + getName() + "\" to satisfy slow-consumer-threshold. Skipping inspection of consumer."); + if (logger.isDebugEnabled()) { + logger.debug("Insufficient messages received on queue \"" + getName() + "\" to satisfy slow-consumer-threshold. Skipping inspection of consumer."); } } else if (consumerRate < threshold) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java index 9b72f51..3cdaa66 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java @@ -30,9 +30,12 @@ import org.apache.activemq.artemis.core.server.ServerMessage; import org.apache.activemq.artemis.core.transaction.Transaction; import org.apache.activemq.artemis.core.transaction.TransactionOperationAbstract; import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl; +import org.jboss.logging.Logger; public class RefsOperation extends TransactionOperationAbstract { + private static final Logger logger = Logger.getLogger(RefsOperation.class); + private final StorageManager storageManager; private Queue queue; List<MessageReference> refsToAck = new ArrayList<>(); @@ -78,8 +81,8 @@ public class RefsOperation extends TransactionOperationAbstract { for (MessageReference ref : refsToAck) { ref.setConsumerId(null); - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("rolling back " + ref); + if (logger.isTraceEnabled()) { + logger.trace("rolling back " + ref); } try { if (ref.isAlreadyAcked()) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java index 318fcfe..b62ea03 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java @@ -62,9 +62,12 @@ import org.apache.activemq.artemis.core.transaction.Transaction; import org.apache.activemq.artemis.core.transaction.TransactionOperation; import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl; import org.apache.activemq.artemis.utils.LinkedListIterator; +import org.jboss.logging.Logger; public class ScaleDownHandler { + private static final Logger logger = Logger.getLogger(ScaleDownHandler.class); + final PagingManager pagingManager; final PostOffice postOffice; private NodeManager nodeManager; @@ -108,7 +111,7 @@ public class ScaleDownHandler { // perform a loop per address for (SimpleString address : postOffice.getAddresses()) { - ActiveMQServerLogger.LOGGER.debug("Scaling down address " + address); + logger.debug("Scaling down address " + address); Bindings bindings = postOffice.getBindingsForAddress(address); // It will get a list of queues on this address, ordered by the number of messages @@ -139,7 +142,7 @@ public class ScaleDownHandler { final Set<Queue> queues, final ClientSession clientSession, final ClientProducer producer) throws Exception { - ActiveMQServerLogger.LOGGER.debug("Scaling down messages on address " + address); + logger.debug("Scaling down messages on address " + address); long messageCount = 0; final HashMap<Queue, QueuesXRefInnerManager> controls = new HashMap<>(); @@ -158,7 +161,7 @@ public class ScaleDownHandler { // compile a list of all the relevant queues and queue iterators for this address for (Queue loopQueue : queues) { - ActiveMQServerLogger.LOGGER.debug("Scaling down messages on address " + address + " / performing loop on queue " + loopQueue); + logger.debug("Scaling down messages on address " + address + " / performing loop on queue " + loopQueue); try (LinkedListIterator<MessageReference> messagesIterator = loopQueue.totalIterator()) { @@ -166,7 +169,7 @@ public class ScaleDownHandler { MessageReference messageReference = messagesIterator.next(); Message message = messageReference.getMessage().copy(); - ActiveMQServerLogger.LOGGER.debug("Reading message " + message + " from queue " + loopQueue); + logger.debug("Reading message " + message + " from queue " + loopQueue); Set<QueuesXRefInnerManager> queuesFound = new HashSet<>(); for (Map.Entry<Queue, QueuesXRefInnerManager> controlEntry : controls.entrySet()) { @@ -175,7 +178,7 @@ public class ScaleDownHandler { queuesFound.add(controlEntry.getValue()); } else if (controlEntry.getValue().lookup(messageReference)) { - ActiveMQServerLogger.LOGGER.debug("Message existed on queue " + controlEntry.getKey().getID() + " removeID=" + controlEntry.getValue().getQueueID()); + logger.debug("Message existed on queue " + controlEntry.getKey().getID() + " removeID=" + controlEntry.getValue().getQueueID()); queuesFound.add(controlEntry.getValue()); } } @@ -190,12 +193,12 @@ public class ScaleDownHandler { message.putBytesProperty(MessageImpl.HDR_ROUTE_TO_IDS, buffer.array()); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { + if (logger.isDebugEnabled()) { if (messageReference.isPaged()) { - ActiveMQServerLogger.LOGGER.debug("*********************<<<<< Scaling down pdgmessage " + message); + logger.debug("*********************<<<<< Scaling down pdgmessage " + message); } else { - ActiveMQServerLogger.LOGGER.debug("*********************<<<<< Scaling down message " + message); + logger.debug("*********************<<<<< Scaling down message " + message); } } @@ -285,7 +288,7 @@ public class ScaleDownHandler { message.putBytesProperty(MessageImpl.HDR_SCALEDOWN_TO_IDS, oldRouteToIDs); } - ActiveMQServerLogger.LOGGER.debug("Scaling down message " + message + " from " + address + " to " + message.getAddress() + " on node " + targetNodeId); + logger.debug("Scaling down message " + message + " from " + address + " to " + message.getAddress() + " on node " + targetNodeId); producer.send(message.getAddress(), message); messageCount++; @@ -315,7 +318,7 @@ public class ScaleDownHandler { List<Xid> preparedTransactions = resourceManager.getPreparedTransactions(); Map<String, Long> queueIDs = new HashMap<>(); for (Xid xid : preparedTransactions) { - ActiveMQServerLogger.LOGGER.debug("Scaling down transaction: " + xid); + logger.debug("Scaling down transaction: " + xid); Transaction transaction = resourceManager.getTransaction(xid); session.start(xid, XAResource.TMNOFLAGS); List<TransactionOperation> allOperations = transaction.getAllOperations(); @@ -431,11 +434,11 @@ public class ScaleDownHandler { long queueID = getQueueID(session, queue.getName()); if (queueID == -1) { session.createQueue(addressName, queue.getName(), queue.getFilter() == null ? null : queue.getFilter().getFilterString(), queue.isDurable()); - ActiveMQServerLogger.LOGGER.debug("Failed to get queue ID, creating queue [addressName=" + addressName + ", queueName=" + queue.getName() + ", filter=" + (queue.getFilter() == null ? "" : queue.getFilter().getFilterString()) + ", durable=" + queue.isDurable() + "]"); + logger.debug("Failed to get queue ID, creating queue [addressName=" + addressName + ", queueName=" + queue.getName() + ", filter=" + (queue.getFilter() == null ? "" : queue.getFilter().getFilterString()) + ", durable=" + queue.isDurable() + "]"); queueID = getQueueID(session, queue.getName()); } - ActiveMQServerLogger.LOGGER.debug("ID for " + queue + " is: " + queueID); + logger.debug("ID for " + queue + " is: " + queueID); return queueID; } @@ -445,7 +448,7 @@ public class ScaleDownHandler { ClientMessage managementMessage = session.createMessage(false); ManagementHelper.putAttribute(managementMessage, "core.queue." + queueName, "ID"); session.start(); - ActiveMQServerLogger.LOGGER.debug("Requesting ID for: " + queueName); + logger.debug("Requesting ID for: " + queueName); ClientMessage reply = requestor.request(managementMessage); Object result = ManagementHelper.getResult(reply); if (result != null && result instanceof Integer) { @@ -560,13 +563,13 @@ public class ScaleDownHandler { MessageReference initialRef = null; for (int i = 0; i < numberOfScans; i++) { - ActiveMQServerLogger.LOGGER.debug("iterating on queue " + queue + " while looking for reference " + reference); + logger.debug("iterating on queue " + queue + " while looking for reference " + reference); memoryIterator = queue.iterator(); while (memoryIterator.hasNext()) { lastRef = memoryIterator.next(); - ActiveMQServerLogger.LOGGER.debug("Iterating on message " + lastRef); + logger.debug("Iterating on message " + lastRef); if (lastRef.getMessage().equals(reference.getMessage())) { memoryIterator.remove(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerImpl.java index 1fda4d8..25f4aa0 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerImpl.java @@ -30,17 +30,17 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.core.filter.Filter; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.MessageReference; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.ScheduledDeliveryHandler; +import org.jboss.logging.Logger; /** * Handles scheduling deliveries to a queue at the correct time. */ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { - private static final boolean trace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(ScheduledDeliveryHandlerImpl.class); private final ScheduledExecutorService scheduledExecutor; @@ -59,8 +59,8 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { long deliveryTime = ref.getScheduledDeliveryTime(); if (deliveryTime > 0 && scheduledExecutor != null) { - if (ScheduledDeliveryHandlerImpl.trace) { - ActiveMQServerLogger.LOGGER.trace("Scheduling delivery for " + ref + " to occur at " + deliveryTime); + if (logger.isTraceEnabled()) { + logger.trace("Scheduling delivery for " + ref + " to occur at " + deliveryTime); } addInPlace(deliveryTime, ref, tail); @@ -137,8 +137,8 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { final long delay = deliveryTime - now; if (delay < 0) { - if (ScheduledDeliveryHandlerImpl.trace) { - ActiveMQServerLogger.LOGGER.trace("calling another scheduler now as deliverTime " + deliveryTime + " < now=" + now); + if (logger.isTraceEnabled()) { + logger.trace("calling another scheduler now as deliverTime " + deliveryTime + " < now=" + now); } // if delay == 0 we will avoid races between adding the scheduler and finishing it ScheduledDeliveryRunnable runnable = new ScheduledDeliveryRunnable(deliveryTime); @@ -147,16 +147,16 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { else if (!runnables.containsKey(deliveryTime)) { ScheduledDeliveryRunnable runnable = new ScheduledDeliveryRunnable(deliveryTime); - if (ScheduledDeliveryHandlerImpl.trace) { - ActiveMQServerLogger.LOGGER.trace("Setting up scheduler for " + deliveryTime + " with a delay of " + delay + " as now=" + now); + if (logger.isTraceEnabled()) { + logger.trace("Setting up scheduler for " + deliveryTime + " with a delay of " + delay + " as now=" + now); } runnables.put(deliveryTime, runnable); scheduledExecutor.schedule(runnable, delay, TimeUnit.MILLISECONDS); } else { - if (ScheduledDeliveryHandlerImpl.trace) { - ActiveMQServerLogger.LOGGER.trace("Couldn't make another scheduler as " + deliveryTime + " is already set, now is " + now); + if (logger.isTraceEnabled()) { + logger.trace("Couldn't make another scheduler as " + deliveryTime + " is already set, now is " + now); } } } @@ -184,16 +184,16 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { // for that reason we will schedule it again so no messages are lost! // we can't just assume deliveryTime here as we could deliver earlier than what we are supposed to // this is basically a hack to work around an OS or JDK bug! - if (trace) { - ActiveMQServerLogger.LOGGER.trace("Scheduler is working around OS imprecisions on " + + if (logger.isTraceEnabled()) { + logger.trace("Scheduler is working around OS imprecisions on " + "timing and re-scheduling an executor. now=" + now + " and deliveryTime=" + deliveryTime); } ScheduledDeliveryHandlerImpl.this.scheduleDelivery(deliveryTime); } - if (ScheduledDeliveryHandlerImpl.trace) { - ActiveMQServerLogger.LOGGER.trace("Is it " + System.currentTimeMillis() + " now and we are running deliveryTime = " + deliveryTime); + if (logger.isTraceEnabled()) { + logger.trace("Is it " + System.currentTimeMillis() + " now and we are running deliveryTime = " + deliveryTime); } synchronized (scheduledReferences) { @@ -217,14 +217,14 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { refs.put(reference.getQueue(), references); } - if (ScheduledDeliveryHandlerImpl.trace) { - ActiveMQServerLogger.LOGGER.trace("sending message " + reference + " to delivery, deliveryTime = " + deliveryTime); + if (logger.isTraceEnabled()) { + logger.trace("sending message " + reference + " to delivery, deliveryTime = " + deliveryTime); } references.addFirst(reference); } - if (ScheduledDeliveryHandlerImpl.trace) { - ActiveMQServerLogger.LOGGER.trace("Finished loop on deliveryTime = " + deliveryTime); + if (logger.isTraceEnabled()) { + logger.trace("Finished loop on deliveryTime = " + deliveryTime); } } @@ -232,8 +232,8 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { Queue queue = entry.getKey(); LinkedList<MessageReference> list = entry.getValue(); - if (trace) { - ActiveMQServerLogger.LOGGER.trace("Delivering " + list.size() + " elements on list to queue " + queue); + if (logger.isTraceEnabled()) { + logger.trace("Delivering " + list.size() + " elements on list to queue " + queue); } queue.addHead(list, true); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java index 7acc6f6..859b57d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java @@ -60,6 +60,7 @@ import org.apache.activemq.artemis.spi.core.remoting.ReadyListener; import org.apache.activemq.artemis.utils.FutureLatch; import org.apache.activemq.artemis.utils.LinkedListIterator; import org.apache.activemq.artemis.utils.TypedProperties; +import org.jboss.logging.Logger; /** * Concrete implementation of a ClientConsumer. @@ -67,7 +68,7 @@ import org.apache.activemq.artemis.utils.TypedProperties; public class ServerConsumerImpl implements ServerConsumer, ReadyListener { // Constants ------------------------------------------------------------------------------------ - private static boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(ServerConsumerImpl.class); // Static --------------------------------------------------------------------------------------- @@ -311,8 +312,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { @Override public HandleStatus handle(final MessageReference ref) throws Exception { if (callback != null && !callback.hasCredits(this) || availableCredits != null && availableCredits.get() <= 0) { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug(this + " is busy for the lack of credits. Current credits = " + + if (logger.isDebugEnabled()) { + logger.debug(this + " is busy for the lack of credits. Current credits = " + availableCredits + " Can't receive reference " + ref); @@ -333,8 +334,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { // If there is a pendingLargeMessage we can't take another message // This has to be checked inside the lock as the set to null is done inside the lock if (largeMessageDeliverer != null) { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug(this + " is busy delivering large message " + + if (logger.isDebugEnabled()) { + logger.debug(this + " is busy delivering large message " + largeMessageDeliverer + ", can't deliver reference " + ref); @@ -344,14 +345,14 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { final ServerMessage message = ref.getMessage(); if (filter != null && !filter.match(message)) { - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("Reference " + ref + " is a noMatch on consumer " + this); + if (logger.isTraceEnabled()) { + logger.trace("Reference " + ref + " is a noMatch on consumer " + this); } return HandleStatus.NO_MATCH; } - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("ServerConsumerImpl::" + this + " Handling reference " + ref); + if (logger.isTraceEnabled()) { + logger.trace("ServerConsumerImpl::" + this + " Handling reference " + ref); } if (!browseOnly) { if (!preAcknowledge) { @@ -430,8 +431,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { @Override public void close(final boolean failed) throws Exception { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("ServerConsumerImpl::" + this + " being closed with failed=" + failed, new Exception("trace")); + if (logger.isTraceEnabled()) { + logger.trace("ServerConsumerImpl::" + this + " being closed with failed=" + failed, new Exception("trace")); } setStarted(false); @@ -453,8 +454,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { while (iter.hasNext()) { MessageReference ref = iter.next(); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("ServerConsumerImpl::" + this + " cancelling reference " + ref); + if (logger.isTraceEnabled()) { + logger.trace("ServerConsumerImpl::" + this + " cancelling reference " + ref); } ref.getQueue().cancel(tx, ref, true); @@ -581,8 +582,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { updateDeliveryCountForCanceledRef(ref, failed); } - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("ServerConsumerImpl::" + this + " Preparing Cancelling list for messageID = " + ref.getMessage().getMessageID() + ", ref = " + ref); + if (logger.isTraceEnabled()) { + logger.trace("ServerConsumerImpl::" + this + " Preparing Cancelling list for messageID = " + ref.getMessage().getMessageID() + ", ref = " + ref); } } @@ -689,8 +690,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { @Override public void receiveCredits(final int credits) { if (credits == -1) { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug(this + ":: FlowControl::Received disable flow control message"); + if (logger.isDebugEnabled()) { + logger.debug(this + ":: FlowControl::Received disable flow control message"); } // No flow control availableCredits = null; @@ -700,14 +701,14 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { } else if (credits == 0) { // reset, used on slow consumers - ActiveMQServerLogger.LOGGER.debug(this + ":: FlowControl::Received reset flow control message"); + logger.debug(this + ":: FlowControl::Received reset flow control message"); availableCredits.set(0); } else { int previous = availableCredits.getAndAdd(credits); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug(this + "::FlowControl::Received " + + if (logger.isDebugEnabled()) { + logger.debug(this + "::FlowControl::Received " + credits + " credits, previous value = " + previous + @@ -716,8 +717,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { } if (previous <= 0 && previous + credits > 0) { - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace(this + "::calling promptDelivery from receiving credits"); + if (logger.isTraceEnabled()) { + logger.trace(this + "::calling promptDelivery from receiving credits"); } promptDelivery(); } @@ -795,8 +796,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { ref = deliveringRefs.poll(); } - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("ACKing ref " + ref + " on tx= " + tx + ", consumer=" + this); + if (logger.isTraceEnabled()) { + logger.trace("ACKing ref " + ref + " on tx= " + tx + ", consumer=" + this); } if (ref == null) { @@ -855,8 +856,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { MessageReference ref; ref = removeReferenceByID(messageID); - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("ACKing ref " + ref + " on tx= " + tx + ", consumer=" + this); + if (logger.isTraceEnabled()) { + logger.trace("ACKing ref " + ref + " on tx= " + tx + ", consumer=" + this); } if (ref == null) { @@ -1028,8 +1029,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { if (availableCredits != null) { availableCredits.addAndGet(-packetSize); - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace(this + "::FlowControl::delivery standard taking " + + if (logger.isTraceEnabled()) { + logger.trace(this + "::FlowControl::delivery standard taking " + packetSize + " from credits, available now is " + availableCredits); @@ -1098,8 +1099,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { } if (availableCredits != null && availableCredits.get() <= 0) { - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace(this + "::FlowControl::delivery largeMessage interrupting as there are no more credits, available=" + + if (logger.isTraceEnabled()) { + logger.trace(this + "::FlowControl::delivery largeMessage interrupting as there are no more credits, available=" + availableCredits); } @@ -1120,8 +1121,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { if (availableCredits != null) { availableCredits.addAndGet(-packetSize); - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace(this + "::FlowControl::" + + if (logger.isTraceEnabled()) { + logger.trace(this + "::FlowControl::" + " deliver initialpackage with " + packetSize + " delivered, available now = " + @@ -1138,8 +1139,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { } else { if (availableCredits != null && availableCredits.get() <= 0) { - if (ServerConsumerImpl.isTrace) { - ActiveMQServerLogger.LOGGER.trace(this + "::FlowControl::deliverLargeMessage Leaving loop of send LargeMessage because of credits, available=" + + if (logger.isTraceEnabled()) { + logger.trace(this + "::FlowControl::deliverLargeMessage Leaving loop of send LargeMessage because of credits, available=" + availableCredits); } @@ -1170,8 +1171,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { if (availableCredits != null) { availableCredits.addAndGet(-packetSize); - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace(this + "::FlowControl::largeMessage deliver continuation, packetSize=" + + if (logger.isTraceEnabled()) { + logger.trace(this + "::FlowControl::largeMessage deliver continuation, packetSize=" + packetSize + " available now=" + availableCredits); @@ -1187,8 +1188,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { } } - if (ServerConsumerImpl.isTrace) { - ActiveMQServerLogger.LOGGER.trace("Finished deliverLargeMessage"); + if (logger.isTraceEnabled()) { + logger.trace("Finished deliverLargeMessage"); } finish(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java index 8203a09..a4c1438 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java @@ -85,6 +85,7 @@ import org.apache.activemq.artemis.utils.TypedProperties; import org.apache.activemq.artemis.utils.UUID; import org.apache.activemq.artemis.utils.json.JSONArray; import org.apache.activemq.artemis.utils.json.JSONObject; +import org.jboss.logging.Logger; /** * Server side Session implementation @@ -92,7 +93,7 @@ import org.apache.activemq.artemis.utils.json.JSONObject; public class ServerSessionImpl implements ServerSession, FailureListener { // Constants ----------------------------------------------------------------------------- - private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(ServerSessionImpl.class); // Static ------------------------------------------------------------------------------- @@ -445,8 +446,8 @@ public class ServerSessionImpl implements ServerSession, FailureListener { Notification notification = new Notification(null, CoreNotificationType.CONSUMER_CREATED, props); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Session with user=" + username + + if (logger.isDebugEnabled()) { + logger.debug("Session with user=" + username + ", connection=" + this.remotingConnection + " created a consumer on queue " + queueName + ", filter = " + filterString); @@ -509,8 +510,8 @@ public class ServerSessionImpl implements ServerSession, FailureListener { tempQueueCleannerUppers.put(name, cleaner); } - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Queue " + name + " created on address " + address + + if (logger.isDebugEnabled()) { + logger.debug("Queue " + name + " created on address " + address + " with filter=" + filterString + " temporary = " + temporary + " durable=" + durable + " on session user=" + this.username + ", connection=" + this.remotingConnection); } @@ -550,15 +551,15 @@ public class ServerSessionImpl implements ServerSession, FailureListener { private void run() { try { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("deleting temporary queue " + bindingName); + if (logger.isDebugEnabled()) { + logger.debug("deleting temporary queue " + bindingName); } try { server.destroyQueue(bindingName, null, false); } catch (ActiveMQException e) { // that's fine.. it can happen due to queue already been deleted - ActiveMQServerLogger.LOGGER.debug(e.getMessage(), e); + logger.debug(e.getMessage(), e); } } catch (Exception e) { @@ -642,7 +643,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { catch (Exception e) { // just ignored // will log it just in case - ActiveMQServerLogger.LOGGER.debug("Ignored exception while acking messageID " + messageID + + logger.debug("Ignored exception while acking messageID " + messageID + " on a rolledback TX", e); } newTX.rollback(); @@ -712,8 +713,8 @@ public class ServerSessionImpl implements ServerSession, FailureListener { @Override public synchronized void commit() throws Exception { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Calling commit"); + if (logger.isTraceEnabled()) { + logger.trace("Calling commit"); } try { if (tx != null) { @@ -785,8 +786,8 @@ public class ServerSessionImpl implements ServerSession, FailureListener { else { Transaction theTx = resourceManager.removeTransaction(xid); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("XAcommit into " + theTx + ", xid=" + xid); + if (logger.isTraceEnabled()) { + logger.trace("XAcommit into " + theTx + ", xid=" + xid); } if (theTx == null) { @@ -799,8 +800,8 @@ public class ServerSessionImpl implements ServerSession, FailureListener { throw new ActiveMQXAException(XAException.XA_HEURRB, "transaction has been heuristically rolled back: " + xid); } else { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("XAcommit into " + theTx + ", xid=" + xid + " cannot find it"); + if (logger.isTraceEnabled()) { + logger.trace("XAcommit into " + theTx + ", xid=" + xid + " cannot find it"); } throw new ActiveMQXAException(XAException.XAER_NOTA, "Cannot find xid in resource manager: " + xid); @@ -939,8 +940,8 @@ public class ServerSessionImpl implements ServerSession, FailureListener { } else { Transaction theTx = resourceManager.removeTransaction(xid); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("xarollback into " + theTx); + if (logger.isTraceEnabled()) { + logger.trace("xarollback into " + theTx); } if (theTx == null) { @@ -953,8 +954,8 @@ public class ServerSessionImpl implements ServerSession, FailureListener { throw new ActiveMQXAException(XAException.XA_HEURRB, "transaction has ben heuristically rolled back: " + xid); } else { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("xarollback into " + theTx + ", xid=" + xid + " forcing a rollback regular"); + if (logger.isTraceEnabled()) { + logger.trace("xarollback into " + theTx + ", xid=" + xid + " forcing a rollback regular"); } try { @@ -972,8 +973,8 @@ public class ServerSessionImpl implements ServerSession, FailureListener { } else { if (theTx.getState() == Transaction.State.SUSPENDED) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("xarollback into " + theTx + " sending tx back as it was suspended"); + if (logger.isTraceEnabled()) { + logger.trace("xarollback into " + theTx + " sending tx back as it was suspended"); } // Put it back @@ -1003,14 +1004,14 @@ public class ServerSessionImpl implements ServerSession, FailureListener { } } catch (Exception e) { - ActiveMQServerLogger.LOGGER.debug("An exception happened while we tried to debug the previous tx, we can ignore this exception", e); + logger.debug("An exception happened while we tried to debug the previous tx, we can ignore this exception", e); } } tx = newTransaction(xid); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("xastart into tx= " + tx); + if (logger.isTraceEnabled()) { + logger.trace("xastart into tx= " + tx); } boolean added = resourceManager.putTransaction(xid, tx); @@ -1032,7 +1033,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { } if (theTX.isEffective()) { - ActiveMQServerLogger.LOGGER.debug("Client failed with Xid " + xid + " but the server already had it " + theTX.getState()); + logger.debug("Client failed with Xid " + xid + " but the server already had it " + theTX.getState()); tx = null; } else { @@ -1040,16 +1041,16 @@ public class ServerSessionImpl implements ServerSession, FailureListener { tx = theTX; } - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("xastart into tx= " + tx); + if (logger.isTraceEnabled()) { + logger.trace("xastart into tx= " + tx); } } @Override public synchronized void xaSuspend() throws Exception { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("xasuspend on " + this.tx); + if (logger.isTraceEnabled()) { + logger.trace("xasuspend on " + this.tx); } if (tx == null) { @@ -1081,8 +1082,8 @@ public class ServerSessionImpl implements ServerSession, FailureListener { else { Transaction theTx = resourceManager.getTransaction(xid); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("xaprepare into " + ", xid=" + xid + ", tx= " + tx); + if (logger.isTraceEnabled()) { + logger.trace("xaprepare into " + ", xid=" + xid + ", tx= " + tx); } if (theTx == null) { @@ -1182,7 +1183,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { ServerConsumer consumer = locateConsumer(consumerID); if (consumer == null) { - ActiveMQServerLogger.LOGGER.debug("There is no consumer with id " + consumerID); + logger.debug("There is no consumer with id " + consumerID); return; } @@ -1202,8 +1203,8 @@ public class ServerSessionImpl implements ServerSession, FailureListener { LargeServerMessage largeMsg = storageManager.createLargeMessage(id, message); - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("sendLarge::" + largeMsg); + if (logger.isTraceEnabled()) { + logger.trace("sendLarge::" + largeMsg); } if (currentLargeMessage != null) { @@ -1248,8 +1249,8 @@ public class ServerSessionImpl implements ServerSession, FailureListener { } } - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("send(message=" + message + ", direct=" + direct + ") being called"); + if (logger.isTraceEnabled()) { + logger.trace("send(message=" + message + ", direct=" + direct + ") being called"); } if (message.getAddress() == null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingBackupActivation.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingBackupActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingBackupActivation.java index d9a5c78..4ae63ea 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingBackupActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingBackupActivation.java @@ -56,7 +56,7 @@ public final class SharedNothingBackupActivation extends Activation { private static final Logger logger = Logger.getLogger(SharedNothingBackupActivation.class); - private static final boolean isTrace = logger.isTraceEnabled(); + //this is how we act when we start as a backup private ReplicaPolicy replicaPolicy; @@ -135,24 +135,24 @@ public final class SharedNothingBackupActivation extends Activation { ClusterController clusterController = activeMQServer.getClusterManager().getClusterController(); clusterController.addClusterTopologyListenerForReplication(nodeLocator); - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Waiting on cluster connection"); } //todo do we actually need to wait? clusterController.awaitConnectionToReplicationCluster(); - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Cluster Connected"); } clusterController.addIncomingInterceptorForReplication(new ReplicationError(activeMQServer, nodeLocator)); // nodeManager.startBackup(); - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Starting backup manager"); } activeMQServer.getBackupManager().start(); - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Set backup Quorum"); } replicationEndpoint.setBackupQuorum(backupQuorum); @@ -160,28 +160,28 @@ public final class SharedNothingBackupActivation extends Activation { replicationEndpoint.setExecutor(activeMQServer.getExecutorFactory().getExecutor()); EndpointConnector endpointConnector = new EndpointConnector(); - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Starting Backup Server"); } ActiveMQServerLogger.LOGGER.backupServerStarted(activeMQServer.getVersion().getFullVersion(), activeMQServer.getNodeManager().getNodeId()); activeMQServer.setState(ActiveMQServerImpl.SERVER_STATE.STARTED); - if (isTrace) logger.trace("Setting server state as started"); + if (logger.isTraceEnabled()) + logger.trace("Setting server state as started"); SharedNothingBackupQuorum.BACKUP_ACTIVATION signal; do { if (closed) { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Activation is closed, so giving up"); } return; } - - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("looking up the node through nodeLocator.locateNode()"); } //locate the first live server to try to replicate @@ -189,12 +189,12 @@ public final class SharedNothingBackupActivation extends Activation { Pair<TransportConfiguration, TransportConfiguration> possibleLive = nodeLocator.getLiveConfiguration(); nodeID = nodeLocator.getNodeID(); - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("nodeID = " + nodeID); } //in a normal (non failback) scenario if we couldn't find our live server we should fail if (!attemptFailBack) { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("attemptFailback=false, nodeID=" + nodeID); } @@ -207,7 +207,7 @@ public final class SharedNothingBackupActivation extends Activation { } try { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Calling clusterController.connectToNodeInReplicatedCluster(" + possibleLive.getA() + ")"); } clusterControl = clusterController.connectToNodeInReplicatedCluster(possibleLive.getA()); @@ -225,7 +225,7 @@ public final class SharedNothingBackupActivation extends Activation { } if (clusterControl == null) { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("sleeping " + clusterController.getRetryIntervalForReplicatedCluster() + " it should retry"); } //its ok to retry here since we haven't started replication yet @@ -243,7 +243,7 @@ public final class SharedNothingBackupActivation extends Activation { */ signal = backupQuorum.waitForStatusChange(); - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Got a signal " + signal + " through backupQuorum.waitForStatusChange()"); } @@ -254,21 +254,21 @@ public final class SharedNothingBackupActivation extends Activation { ActiveMQServerImpl.stopComponent(replicationEndpoint); // time to give up if (!activeMQServer.isStarted() || signal == STOP) { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("giving up on the activation:: activemqServer.isStarted=" + activeMQServer.isStarted() + " while signal = " + signal); } return; } // time to fail over else if (signal == FAIL_OVER) { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("signal == FAIL_OVER, breaking the loop"); } break; } // something has gone badly run restart from scratch else if (signal == SharedNothingBackupQuorum.BACKUP_ACTIVATION.FAILURE_REPLICATING) { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Starting a new thread to stop the server!"); } @@ -276,7 +276,7 @@ public final class SharedNothingBackupActivation extends Activation { @Override public void run() { try { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Calling activeMQServer.stop()"); } activeMQServer.stop(); @@ -299,7 +299,7 @@ public final class SharedNothingBackupActivation extends Activation { } } while (signal == SharedNothingBackupQuorum.BACKUP_ACTIVATION.ALREADY_REPLICATING); - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Activation loop finished, current signal = " + signal); } @@ -310,8 +310,7 @@ public final class SharedNothingBackupActivation extends Activation { throw ActiveMQMessageBundle.BUNDLE.backupServerNotInSync(); } - - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("setReplicaPolicy::" + replicaPolicy); } @@ -347,7 +346,7 @@ public final class SharedNothingBackupActivation extends Activation { } } catch (Exception e) { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace(e.getMessage() + ", serverStarted=" + activeMQServer.isStarted(), e); } if ((e instanceof InterruptedException || e instanceof IllegalStateException) && !activeMQServer.isStarted()) @@ -462,7 +461,7 @@ public final class SharedNothingBackupActivation extends Activation { * @throws ActiveMQException */ public void remoteFailOver(ReplicationLiveIsStoppingMessage.LiveStopping finalMessage) throws ActiveMQException { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Remote fail-over, got message=" + finalMessage + ", backupUpToDate=" + backupUpToDate); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java index 358d7ef..fcc6792 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java @@ -16,6 +16,11 @@ */ package org.apache.activemq.artemis.core.server.impl; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.TimeUnit; + import org.apache.activemq.artemis.api.core.ActiveMQAlreadyReplicatingException; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException; @@ -23,8 +28,8 @@ import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; import org.apache.activemq.artemis.api.core.Pair; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; -import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; +import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener; import org.apache.activemq.artemis.api.core.client.TopologyMember; import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal; import org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal; @@ -48,14 +53,12 @@ import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.cluster.ClusterConnection; import org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy; import org.apache.activemq.artemis.spi.core.remoting.Acceptor; - -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.TimeUnit; +import org.jboss.logging.Logger; public class SharedNothingLiveActivation extends LiveActivation { + private static final Logger logger = Logger.getLogger(SharedNothingLiveActivation.class); + //this is how we act when we initially start as a live private ReplicatedPolicy replicatedPolicy; @@ -126,7 +129,7 @@ public class SharedNothingLiveActivation extends LiveActivation { channel.send(new BackupReplicationStartFailedMessage(BackupReplicationStartFailedMessage.BackupRegistrationProblem.ALREADY_REPLICATING)); } catch (ActiveMQException e) { - ActiveMQServerLogger.LOGGER.debug("Failed to process backup registration packet", e); + logger.debug("Failed to process backup registration packet", e); channel.send(new BackupReplicationStartFailedMessage(BackupReplicationStartFailedMessage.BackupRegistrationProblem.EXCEPTION)); } }