Individualizing logger.traces on org.apache.activemq.artemis.core.server (artemis-server project)
This makes it easier to debug through loggers Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/f0df9d8c Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/f0df9d8c Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/f0df9d8c Branch: refs/heads/master Commit: f0df9d8c78883564c95033199bebbfd13e77e5ad Parents: 2135911 Author: Clebert Suconic <[email protected]> Authored: Wed Apr 27 18:01:41 2016 -0400 Committer: Clebert Suconic <[email protected]> Committed: Thu Apr 28 14:35:11 2016 -0400 ---------------------------------------------------------------------- .../core/paging/cursor/PagedReferenceImpl.java | 11 +- .../cursor/impl/PageCursorProviderImpl.java | 43 ++++--- .../impl/PageSubscriptionCounterImpl.java | 7 +- .../cursor/impl/PageSubscriptionImpl.java | 23 ++-- .../activemq/artemis/core/paging/impl/Page.java | 16 +-- .../core/paging/impl/PagingManagerImpl.java | 18 +-- .../core/paging/impl/PagingStoreImpl.java | 9 +- .../impl/journal/BatchingIDGenerator.java | 5 +- .../impl/journal/LargeServerMessageImpl.java | 7 +- .../impl/journal/LargeServerMessageInSync.java | 15 +-- .../core/postoffice/impl/BindingsImpl.java | 27 ++-- .../postoffice/impl/DuplicateIDCacheImpl.java | 43 ++++--- .../core/postoffice/impl/PostOfficeImpl.java | 58 +++++---- .../postoffice/impl/SimpleAddressManager.java | 8 +- .../core/ServerSessionPacketHandler.java | 23 ++-- .../core/impl/ActiveMQPacketHandler.java | 9 +- .../protocol/core/impl/CoreProtocolManager.java | 4 +- .../core/remoting/impl/invm/InVMConnection.java | 11 +- .../core/remoting/impl/invm/InVMConnector.java | 10 +- .../server/impl/RemotingServiceImpl.java | 35 ++--- .../core/replication/ReplicationEndpoint.java | 20 +-- .../core/replication/ReplicationManager.java | 11 +- .../core/security/impl/SecurityStoreImpl.java | 17 +-- .../artemis/core/server/MemoryManager.java | 9 +- .../core/server/cluster/BackupManager.java | 11 +- .../core/server/cluster/ClusterController.java | 13 +- .../core/server/cluster/ClusterManager.java | 17 ++- .../core/server/cluster/impl/BridgeImpl.java | 93 +++++++------- .../server/cluster/impl/BroadcastGroupImpl.java | 5 +- .../cluster/impl/ClusterConnectionBridge.java | 29 +++-- .../cluster/impl/ClusterConnectionImpl.java | 97 +++++++------- .../cluster/impl/RemoteQueueBindingImpl.java | 8 +- .../server/group/impl/LocalGroupingHandler.java | 19 +-- .../core/server/impl/ActiveMQServerImpl.java | 15 ++- .../impl/AnyLiveNodeLocatorForScaleDown.java | 8 +- .../impl/AutoCreatedQueueManagerImpl.java | 11 +- .../artemis/core/server/impl/DivertImpl.java | 8 +- .../core/server/impl/FileLockNodeManager.java | 11 +- .../impl/LegacyLDAPSecuritySettingPlugin.java | 22 ++-- .../core/server/impl/LiveOnlyActivation.java | 14 +- .../impl/NamedLiveNodeLocatorForScaleDown.java | 8 +- .../server/impl/PostOfficeJournalLoader.java | 15 ++- .../artemis/core/server/impl/QueueImpl.java | 127 ++++++++++--------- .../artemis/core/server/impl/RefsOperation.java | 7 +- .../core/server/impl/ScaleDownHandler.java | 33 ++--- .../impl/ScheduledDeliveryHandlerImpl.java | 40 +++--- .../core/server/impl/ServerConsumerImpl.java | 77 +++++------ .../core/server/impl/ServerSessionImpl.java | 73 +++++------ .../impl/SharedNothingBackupActivation.java | 47 ++++--- .../impl/SharedNothingLiveActivation.java | 17 ++- .../impl/SharedStoreBackupActivation.java | 7 +- .../server/impl/SharedStoreLiveActivation.java | 11 +- .../server/impl/TransientQueueManagerImpl.java | 7 +- .../management/impl/ManagementServiceImpl.java | 33 ++--- .../impl/HierarchicalObjectRepository.java | 5 +- .../core/transaction/impl/TransactionImpl.java | 39 +++--- .../security/ActiveMQJAASSecurityManager.java | 12 +- .../security/jaas/CertificateLoginModule.java | 12 +- .../core/security/jaas/GuestLoginModule.java | 16 ++- .../spi/core/security/jaas/InVMLoginModule.java | 13 +- .../spi/core/security/jaas/LDAPLoginModule.java | 51 ++++---- .../core/security/jaas/PropertiesLoader.java | 8 +- .../security/jaas/PropertiesLoginModule.java | 12 +- .../security/jaas/ReloadableProperties.java | 7 +- .../artemis/tests/util/ActiveMQTestBase.java | 7 +- 65 files changed, 805 insertions(+), 699 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java index 99e9160..33e1086 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java @@ -26,10 +26,11 @@ import org.apache.activemq.artemis.core.server.MessageReference; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.ServerMessage; import org.apache.activemq.artemis.core.transaction.Transaction; +import org.jboss.logging.Logger; public class PagedReferenceImpl implements PagedReference { - private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(PagedReferenceImpl.class); private final PagePosition position; @@ -173,8 +174,8 @@ public class PagedReferenceImpl implements PagedReference { @Override public void incrementDeliveryCount() { deliveryCount.incrementAndGet(); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("++deliveryCount = " + deliveryCount + " for " + this, new Exception("trace")); + if (logger.isTraceEnabled()) { + logger.trace("++deliveryCount = " + deliveryCount + " for " + this, new Exception("trace")); } } @@ -182,8 +183,8 @@ public class PagedReferenceImpl implements PagedReference { @Override public void decrementDeliveryCount() { deliveryCount.decrementAndGet(); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("--deliveryCount = " + deliveryCount + " for " + this, new Exception("trace")); + if (logger.isTraceEnabled()) { + logger.trace("--deliveryCount = " + deliveryCount + " for " + this, new Exception("trace")); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java index 7dad12b..9862a1f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java @@ -40,6 +40,7 @@ import org.apache.activemq.artemis.core.transaction.Transaction; import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl; import org.apache.activemq.artemis.utils.FutureLatch; import org.apache.activemq.artemis.utils.SoftValueHashMap; +import org.jboss.logging.Logger; /** * A PageProviderIMpl @@ -50,7 +51,7 @@ import org.apache.activemq.artemis.utils.SoftValueHashMap; public class PageCursorProviderImpl implements PageCursorProvider { // Constants ----------------------------------------------------- - boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(PageCursorProviderImpl.class); // Attributes ---------------------------------------------------- @@ -90,8 +91,8 @@ public class PageCursorProviderImpl implements PageCursorProvider { @Override public synchronized PageSubscription createSubscription(long cursorID, Filter filter, boolean persistent) { - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace(this.pagingStore.getAddress() + " creating subscription " + cursorID + " with filter " + filter, new Exception("trace")); + if (logger.isTraceEnabled()) { + logger.trace(this.pagingStore.getAddress() + " creating subscription " + cursorID + " with filter " + filter, new Exception("trace")); } if (activeCursors.containsKey(cursorID)) { @@ -145,8 +146,8 @@ public class PageCursorProviderImpl implements PageCursorProvider { cache = createPageCache(pageId); // anyone reading from this cache will have to wait reading to finish first // we also want only one thread reading this cache - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("adding " + pageId + " into cursor = " + this.pagingStore.getAddress()); + if (logger.isTraceEnabled()) { + logger.trace("adding " + pageId + " into cursor = " + this.pagingStore.getAddress()); } readPage((int) pageId, cache); softCache.put(pageId, cache); @@ -355,8 +356,8 @@ public class PageCursorProviderImpl implements PageCursorProvider { return; } - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Asserting cleanup for address " + this.pagingStore.getAddress()); + if (logger.isDebugEnabled()) { + logger.debug("Asserting cleanup for address " + this.pagingStore.getAddress()); } ArrayList<PageSubscription> cursorList = cloneSubscriptions(); @@ -375,8 +376,8 @@ public class PageCursorProviderImpl implements PageCursorProvider { // All the pages on the cursor are complete.. so we will cleanup everything and store a bookmark if (complete) { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Address " + pagingStore.getAddress() + + if (logger.isDebugEnabled()) { + logger.debug("Address " + pagingStore.getAddress() + " is leaving page mode as all messages are consumed and acknowledged from the page store"); } @@ -405,8 +406,8 @@ public class PageCursorProviderImpl implements PageCursorProvider { pagingStore.stopPaging(); } else { - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("Couldn't cleanup page on address " + this.pagingStore.getAddress() + + if (logger.isTraceEnabled()) { + logger.trace("Couldn't cleanup page on address " + this.pagingStore.getAddress() + " as numberOfPages == " + pagingStore.getNumberOfPages() + " and currentPage.numberOfMessages = " + @@ -431,8 +432,8 @@ public class PageCursorProviderImpl implements PageCursorProvider { cache = softCache.get((long) depagedPage.getPageId()); } - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Removing page " + depagedPage.getPageId() + " from page-cache"); + if (logger.isTraceEnabled()) { + logger.trace("Removing page " + depagedPage.getPageId() + " from page-cache"); } if (cache == null) { @@ -482,16 +483,16 @@ public class PageCursorProviderImpl implements PageCursorProvider { for (PageSubscription cursor : cursorList) { if (!cursor.isComplete(minPage)) { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Cursor " + cursor + " was considered incomplete at page " + minPage); + if (logger.isDebugEnabled()) { + logger.debug("Cursor " + cursor + " was considered incomplete at page " + minPage); } complete = false; break; } else { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Cursor " + cursor + "was considered **complete** at page " + minPage); + if (logger.isDebugEnabled()) { + logger.debug("Cursor " + cursor + "was considered **complete** at page " + minPage); } } } @@ -563,8 +564,8 @@ public class PageCursorProviderImpl implements PageCursorProvider { for (PageSubscription cursor : cursorList) { long firstPage = cursor.getFirstPage(); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug(this.pagingStore.getAddress() + " has a cursor " + cursor + " with first page=" + firstPage); + if (logger.isDebugEnabled()) { + logger.debug(this.pagingStore.getAddress() + " has a cursor " + cursor + " with first page=" + firstPage); } // the cursor will return -1 if the cursor is empty @@ -573,8 +574,8 @@ public class PageCursorProviderImpl implements PageCursorProvider { } } - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug(this.pagingStore.getAddress() + " has minPage=" + minPage); + if (logger.isDebugEnabled()) { + logger.debug(this.pagingStore.getAddress() + " has minPage=" + minPage); } return minPage; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java index c7b8c5c..a28288a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java @@ -35,13 +35,14 @@ import org.apache.activemq.artemis.core.transaction.TransactionOperation; import org.apache.activemq.artemis.core.transaction.TransactionOperationAbstract; import org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes; import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl; +import org.jboss.logging.Logger; /** * This class will encapsulate the persistent counters for the PagingSubscription */ public class PageSubscriptionCounterImpl implements PageSubscriptionCounter { - private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(PageSubscriptionCounterImpl.class); private static final int FLUSH_COUNTER = 1000; @@ -327,8 +328,8 @@ public class PageSubscriptionCounterImpl implements PageSubscriptionCounter { newRecordID = storage.storePageCounter(txCleanup, subscriptionID, valueReplace); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Replacing page-counter record = " + recordID + " by record = " + newRecordID + " on subscriptionID = " + this.subscriptionID + " for queue = " + this.subscription.getQueue().getName()); + if (logger.isTraceEnabled()) { + logger.trace("Replacing page-counter record = " + recordID + " by record = " + newRecordID + " on subscriptionID = " + this.subscriptionID + " for queue = " + this.subscription.getQueue().getName()); } storage.commit(txCleanup); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java index eae44dd..57b4efe 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java @@ -57,10 +57,11 @@ import org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes; import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl; import org.apache.activemq.artemis.utils.ConcurrentHashSet; import org.apache.activemq.artemis.utils.FutureLatch; +import org.jboss.logging.Logger; final class PageSubscriptionImpl implements PageSubscription { - private final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(PageSubscriptionImpl.class); private boolean empty = true; @@ -262,7 +263,7 @@ final class PageSubscriptionImpl implements PageSubscription { if (currentPage != null && entry.getKey() == pageStore.getCurrentPage().getPageId() && currentPage.isLive()) { - ActiveMQServerLogger.LOGGER.trace("We can't clear page " + entry.getKey() + + logger.trace("We can't clear page " + entry.getKey() + " now since it's the current page"); } else { @@ -634,8 +635,8 @@ final class PageSubscriptionImpl implements PageSubscription { @Override public void processReload() throws Exception { if (recoveredACK != null) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("********** processing reload!!!!!!!"); + if (logger.isTraceEnabled()) { + logger.trace("********** processing reload!!!!!!!"); } Collections.sort(recoveredACK); @@ -773,12 +774,12 @@ final class PageSubscriptionImpl implements PageSubscription { // The only exception is on non storage events such as not matching messages private PageCursorInfo processACK(final PagePosition pos) { if (lastAckedPosition == null || pos.compareTo(lastAckedPosition) > 0) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("a new position is being processed as ACK"); + if (logger.isTraceEnabled()) { + logger.trace("a new position is being processed as ACK"); } if (lastAckedPosition != null && lastAckedPosition.getPageNr() != pos.getPageNr()) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Scheduling cleanup on pageSubscription for address = " + pageStore.getAddress() + " queue = " + this.getQueue().getName()); + if (logger.isTraceEnabled()) { + logger.trace("Scheduling cleanup on pageSubscription for address = " + pageStore.getAddress() + " queue = " + this.getQueue().getName()); } // there's a different page being acked, we will do the check right away @@ -976,9 +977,9 @@ final class PageSubscriptionImpl implements PageSubscription { public void addACK(final PagePosition posACK) { - if (isTrace) { + if (logger.isTraceEnabled()) { try { - ActiveMQServerLogger.LOGGER.trace("numberOfMessages = " + getNumberOfMessages() + + logger.trace("numberOfMessages = " + getNumberOfMessages() + " confirmed = " + (confirmed.get() + 1) + " pendingTX = " + pendingTX + @@ -986,7 +987,7 @@ final class PageSubscriptionImpl implements PageSubscription { pageId + " posACK = " + posACK); } catch (Throwable ignored) { - ActiveMQServerLogger.LOGGER.debug(ignored.getMessage(), ignored); + logger.debug(ignored.getMessage(), ignored); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java index 07579a2..83a6c53 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java @@ -36,12 +36,12 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.LargeServerMessage; import org.apache.activemq.artemis.utils.ConcurrentHashSet; import org.apache.activemq.artemis.utils.DataConstants; +import org.jboss.logging.Logger; public final class Page implements Comparable<Page> { // Constants ----------------------------------------------------- - private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); - private static final boolean isDebug = ActiveMQServerLogger.LOGGER.isDebugEnabled(); + private static final Logger logger = Logger.getLogger(Page.class); public static final int SIZE_RECORD = DataConstants.SIZE_BYTE + DataConstants.SIZE_INT + DataConstants.SIZE_BYTE; @@ -98,8 +98,8 @@ public final class Page implements Comparable<Page> { } public synchronized List<PagedMessage> read(StorageManager storage) throws Exception { - if (isDebug) { - ActiveMQServerLogger.LOGGER.debug("reading page " + this.pageId + " on address = " + storeName); + if (logger.isDebugEnabled()) { + logger.debug("reading page " + this.pageId + " on address = " + storeName); } if (!file.isOpen()) { @@ -142,8 +142,8 @@ public final class Page implements Comparable<Page> { throw new IllegalStateException("Internal error, it wasn't possible to locate END_BYTE " + b); } msg.initMessage(storage); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Reading message " + msg + " on pageId=" + this.pageId + " for address=" + storeName); + if (logger.isTraceEnabled()) { + logger.trace("Reading message " + msg + " on pageId=" + this.pageId + " for address=" + storeName); } messages.add(msg); } @@ -250,8 +250,8 @@ public final class Page implements Comparable<Page> { storageManager.pageDeleted(storeName, pageId); } - if (isDebug) { - ActiveMQServerLogger.LOGGER.debug("Deleting pageId=" + pageId + " on store " + storeName); + if (logger.isDebugEnabled()) { + logger.debug("Deleting pageId=" + pageId + " on store " + storeName); } if (messages != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java index 09dd1f6..3c76059 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java @@ -28,12 +28,14 @@ import org.apache.activemq.artemis.core.paging.PageTransactionInfo; import org.apache.activemq.artemis.core.paging.PagingManager; import org.apache.activemq.artemis.core.paging.PagingStore; import org.apache.activemq.artemis.core.paging.PagingStoreFactory; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.settings.HierarchicalRepository; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; +import org.jboss.logging.Logger; public final class PagingManagerImpl implements PagingManager { + private static final Logger logger = Logger.getLogger(PagingManagerImpl.class); + private volatile boolean started = false; /** @@ -57,8 +59,6 @@ public final class PagingManagerImpl implements PagingManager { // Static // -------------------------------------------------------------------------------------------------------------------------- - private static boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); - // Constructors // -------------------------------------------------------------------------------------------------------------------- @@ -176,24 +176,24 @@ public final class PagingManagerImpl implements PagingManager { @Override public void addTransaction(final PageTransactionInfo pageTransaction) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Adding pageTransaction " + pageTransaction.getTransactionID()); + if (logger.isTraceEnabled()) { + logger.trace("Adding pageTransaction " + pageTransaction.getTransactionID()); } transactions.put(pageTransaction.getTransactionID(), pageTransaction); } @Override public void removeTransaction(final long id) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Removing pageTransaction " + id); + if (logger.isTraceEnabled()) { + logger.trace("Removing pageTransaction " + id); } transactions.remove(id); } @Override public PageTransactionInfo getTransaction(final long id) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("looking up pageTX = " + id); + if (logger.isTraceEnabled()) { + logger.trace("looking up pageTX = " + id); } return transactions.get(id); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java index 85a2dc2..a7baf84 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java @@ -62,12 +62,15 @@ import org.apache.activemq.artemis.core.transaction.Transaction; import org.apache.activemq.artemis.core.transaction.TransactionOperation; import org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes; import org.apache.activemq.artemis.utils.FutureLatch; +import org.jboss.logging.Logger; /** * @see PagingStore */ public class PagingStoreImpl implements PagingStore { + private static final Logger logger = Logger.getLogger(Page.class); + private final SimpleString address; private final StorageManager storageManager; @@ -121,8 +124,6 @@ public class PagingStoreImpl implements PagingStore { private volatile AtomicBoolean blocking = new AtomicBoolean(false); - private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); - public PagingStoreImpl(final SimpleString address, final ScheduledExecutorService scheduledExecutor, final long syncTimeout, @@ -828,8 +829,8 @@ public class PagingStoreImpl implements PagingStore { sync(); } - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Paging message " + pagedMessage + " on pageStore " + this.getStoreName() + + if (logger.isTraceEnabled()) { + logger.trace("Paging message " + pagedMessage + " on pageStore " + this.getStoreName() + " pageId=" + currentPage.getPageId()); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/BatchingIDGenerator.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/BatchingIDGenerator.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/BatchingIDGenerator.java index 346bb40..a3e9640 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/BatchingIDGenerator.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/BatchingIDGenerator.java @@ -27,6 +27,7 @@ import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.utils.DataConstants; import org.apache.activemq.artemis.utils.IDGenerator; +import org.jboss.logging.Logger; /** * An ID generator that allocates a batch of IDs of size {@link #checkpointSize} and records the ID @@ -36,6 +37,8 @@ import org.apache.activemq.artemis.utils.IDGenerator; */ public final class BatchingIDGenerator implements IDGenerator { + private static final Logger logger = Logger.getLogger(BatchingIDGenerator.class); + private final AtomicLong counter; private final long checkpointSize; @@ -124,7 +127,7 @@ public final class BatchingIDGenerator implements IDGenerator { // while notifications are being sent and ID gerated. // If the ID is intended to the journal you would know soon enough // so we just ignore this for now - ActiveMQServerLogger.LOGGER.debug("The journalStorageManager is not loaded. " + "This is probably ok as long as it's a notification being sent after shutdown"); + logger.debug("The journalStorageManager is not loaded. " + "This is probably ok as long as it's a notification being sent after shutdown"); } else { storeID(counter.getAndIncrement(), nextID); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java index d85b17a..be193eb 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java @@ -33,11 +33,12 @@ import org.apache.activemq.artemis.core.server.ServerMessage; import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl; import org.apache.activemq.artemis.utils.DataConstants; import org.apache.activemq.artemis.utils.TypedProperties; +import org.jboss.logging.Logger; public final class LargeServerMessageImpl extends ServerMessageImpl implements LargeServerMessage { // Constants ----------------------------------------------------- - private static boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(LargeServerMessageImpl.class); // Attributes ---------------------------------------------------- @@ -183,8 +184,8 @@ public final class LargeServerMessageImpl extends ServerMessageImpl implements L private void checkDelete() throws Exception { if (getRefCount() <= 0) { - if (LargeServerMessageImpl.isTrace) { - ActiveMQServerLogger.LOGGER.trace("Deleting file " + file + " as the usage was complete"); + if (logger.isTraceEnabled()) { + logger.trace("Deleting file " + file + " as the usage was complete"); } try { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java index 6c35c3f..0c95b75 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java @@ -32,7 +32,7 @@ import org.jboss.logging.Logger; public final class LargeServerMessageInSync implements ReplicatedLargeMessage { private static final Logger logger = Logger.getLogger(LargeServerMessageInSync.class); - private static final boolean isTrace = logger.isTraceEnabled(); + private final LargeServerMessage mainLM; private final StorageManager storageManager; @@ -58,7 +58,7 @@ public final class LargeServerMessageInSync implements ReplicatedLargeMessage { try { if (appendFile != null) { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("joinSyncedData on " + mainLM + ", currentSize on mainMessage=" + mainSeqFile.size() + ", appendFile size = " + appendFile.size()); } @@ -66,7 +66,7 @@ public final class LargeServerMessageInSync implements ReplicatedLargeMessage { deleteAppendFile(); } else { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("joinSyncedData, appendFile is null, ignoring joinSyncedData on " + mainLM); } } @@ -75,8 +75,7 @@ public final class LargeServerMessageInSync implements ReplicatedLargeMessage { logger.warn("Error while sincing data on largeMessageInSync::" + mainLM); } - - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("joinedSyncData on " + mainLM + " finished with " + mainSeqFile.size()); } @@ -103,7 +102,7 @@ public final class LargeServerMessageInSync implements ReplicatedLargeMessage { @Override public synchronized void releaseResources() { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("release resources called on " + mainLM, new Exception("trace")); } mainLM.releaseResources(); @@ -145,14 +144,14 @@ public final class LargeServerMessageInSync implements ReplicatedLargeMessage { return; if (syncDone) { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("Adding " + bytes.length + " towards sync message::" + mainLM); } mainLM.addBytes(bytes); return; } - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("addBytes(bytes.length=" + bytes.length + ") on message=" + mainLM); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java index 7ab5a89..c86b722 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java @@ -43,14 +43,15 @@ import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancing import org.apache.activemq.artemis.core.server.group.GroupingHandler; import org.apache.activemq.artemis.core.server.group.impl.Proposal; import org.apache.activemq.artemis.core.server.group.impl.Response; +import org.jboss.logging.Logger; public final class BindingsImpl implements Bindings { + private static final Logger logger = Logger.getLogger(BindingsImpl.class); + // This is public as we use on test assertions public static final int MAX_GROUP_RETRY = 10; - private static boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); - private final ConcurrentMap<SimpleString, List<Binding>> routingNameBindingMap = new ConcurrentHashMap<>(); private final Map<SimpleString, Integer> routingNamePositions = new ConcurrentHashMap<>(); @@ -92,8 +93,8 @@ public final class BindingsImpl implements Bindings { @Override public void addBinding(final Binding binding) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("addBinding(" + binding + ") being called"); + if (logger.isTraceEnabled()) { + logger.trace("addBinding(" + binding + ") being called"); } if (binding.isExclusive()) { exclusiveBindings.add(binding); @@ -120,8 +121,8 @@ public final class BindingsImpl implements Bindings { bindingsMap.put(binding.getID(), binding); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Adding binding " + binding + " into " + this + " bindingTable: " + debugBindings()); + if (logger.isTraceEnabled()) { + logger.trace("Adding binding " + binding + " into " + this + " bindingTable: " + debugBindings()); } } @@ -147,8 +148,8 @@ public final class BindingsImpl implements Bindings { bindingsMap.remove(binding.getID()); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Removing binding " + binding + " from " + this + " bindingTable: " + debugBindings()); + if (logger.isTraceEnabled()) { + logger.trace("Removing binding " + binding + " from " + this + " bindingTable: " + debugBindings()); } } @@ -160,8 +161,8 @@ public final class BindingsImpl implements Bindings { return false; } - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Redistributing message " + message); + if (logger.isTraceEnabled()) { + logger.trace("Redistributing message " + message); } SimpleString routingName = originatingQueue.getName(); @@ -287,8 +288,8 @@ public final class BindingsImpl implements Bindings { routeUsingStrictOrdering(message, context, groupingHandler, groupId, 0); } else { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Routing message " + message + " on binding=" + this); + if (logger.isTraceEnabled()) { + logger.trace("Routing message " + message + " on binding=" + this); } for (Map.Entry<SimpleString, List<Binding>> entry : routingNameBindingMap.entrySet()) { SimpleString routingName = entry.getKey(); @@ -451,7 +452,7 @@ public final class BindingsImpl implements Bindings { resp = groupingGroupingHandler.propose(new Proposal(fullID, theBinding.getClusterName())); if (resp == null) { - ActiveMQServerLogger.LOGGER.debug("it got a timeout on propose, trying again, number of retries: " + tries); + logger.debug("it got a timeout on propose, trying again, number of retries: " + tries); // it timed out, so we will check it through routeAndcheckNull theBinding = null; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/DuplicateIDCacheImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/DuplicateIDCacheImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/DuplicateIDCacheImpl.java index fb6559c..29774d6 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/DuplicateIDCacheImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/DuplicateIDCacheImpl.java @@ -31,6 +31,7 @@ import org.apache.activemq.artemis.core.server.MessageReference; import org.apache.activemq.artemis.core.transaction.Transaction; import org.apache.activemq.artemis.core.transaction.TransactionOperationAbstract; import org.apache.activemq.artemis.utils.ByteUtil; +import org.jboss.logging.Logger; /** * A DuplicateIDCacheImpl @@ -39,7 +40,7 @@ import org.apache.activemq.artemis.utils.ByteUtil; */ public class DuplicateIDCacheImpl implements DuplicateIDCache { - private final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(DuplicateIDCacheImpl.class); // ByteHolder, position private final Map<ByteArrayHolder, Integer> cache = new ConcurrentHashMap<>(); @@ -88,8 +89,8 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { if (txID == -1) { txID = storageManager.generateID(); } - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("DuplicateIDCacheImpl::load deleting id=" + describeID(id.getA(), id.getB())); + if (logger.isTraceEnabled()) { + logger.trace("DuplicateIDCacheImpl::load deleting id=" + describeID(id.getA(), id.getB())); } storageManager.deleteDuplicateIDTransactional(txID, id.getB()); @@ -103,8 +104,8 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { cache.put(bah, ids.size()); ids.add(pair); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("DuplicateIDCacheImpl::load loading id=" + describeID(id.getA(), id.getB())); + if (logger.isTraceEnabled()) { + logger.trace("DuplicateIDCacheImpl::load loading id=" + describeID(id.getA(), id.getB())); } } @@ -124,8 +125,8 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { @Override public void deleteFromCache(byte[] duplicateID) throws Exception { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("DuplicateIDCacheImpl::deleteFromCache deleting id=" + describeID(duplicateID, 0)); + if (logger.isTraceEnabled()) { + logger.trace("DuplicateIDCacheImpl::deleteFromCache deleting id=" + describeID(duplicateID, 0)); } ByteArrayHolder bah = new ByteArrayHolder(duplicateID); @@ -141,8 +142,8 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { if (id.getA().equals(bah)) { id.setA(null); storageManager.deleteDuplicateID(id.getB()); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("DuplicateIDCacheImpl(" + this.address + ")::deleteFromCache deleting id=" + describeID(duplicateID, id.getB())); + if (logger.isTraceEnabled()) { + logger.trace("DuplicateIDCacheImpl(" + this.address + ")::deleteFromCache deleting id=" + describeID(duplicateID, id.getB())); } id.setB(null); } @@ -165,7 +166,7 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { boolean contains = cache.get(new ByteArrayHolder(duplID)) != null; if (contains) { - ActiveMQServerLogger.LOGGER.trace("DuplicateIDCacheImpl(" + this.address + ")::constains found a duplicate " + describeID(duplID, 0)); + logger.trace("DuplicateIDCacheImpl(" + this.address + ")::constains found a duplicate " + describeID(duplID, 0)); } return contains; } @@ -220,8 +221,8 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { addToCacheInMemory(duplID, recordID); } else { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("DuplicateIDCacheImpl(" + this.address + ")::addToCache Adding duplicateID TX operation for " + describeID(duplID, recordID)); + if (logger.isTraceEnabled()) { + logger.trace("DuplicateIDCacheImpl(" + this.address + ")::addToCache Adding duplicateID TX operation for " + describeID(duplID, recordID)); } // For a tx, it's important that the entry is not added to the cache until commit // since if the client fails then resends them tx we don't want it to get rejected @@ -236,8 +237,8 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { } private synchronized void addToCacheInMemory(final byte[] duplID, final long recordID) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("DuplicateIDCacheImpl(" + this.address + ")::addToCacheInMemory Adding " + describeID(duplID, recordID)); + if (logger.isTraceEnabled()) { + logger.trace("DuplicateIDCacheImpl(" + this.address + ")::addToCacheInMemory Adding " + describeID(duplID, recordID)); } ByteArrayHolder holder = new ByteArrayHolder(duplID); @@ -252,8 +253,8 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { // The id here might be null if it was explicit deleted if (id.getA() != null) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("DuplicateIDCacheImpl(" + this.address + ")::addToCacheInMemory removing excess duplicateDetection " + describeID(id.getA().bytes, id.getB())); + if (logger.isTraceEnabled()) { + logger.trace("DuplicateIDCacheImpl(" + this.address + ")::addToCacheInMemory removing excess duplicateDetection " + describeID(id.getA().bytes, id.getB())); } cache.remove(id.getA()); @@ -278,8 +279,8 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { // -1 would mean null on this case id.setB(recordID >= 0 ? recordID : null); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("DuplicateIDCacheImpl(" + this.address + ")::addToCacheInMemory replacing old duplicateID by " + describeID(id.getA().bytes, id.getB())); + if (logger.isTraceEnabled()) { + logger.trace("DuplicateIDCacheImpl(" + this.address + ")::addToCacheInMemory replacing old duplicateID by " + describeID(id.getA().bytes, id.getB())); } holder.pos = pos; @@ -287,8 +288,8 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { else { id = new Pair<>(holder, recordID >= 0 ? recordID : null); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("DuplicateIDCacheImpl(" + this.address + ")::addToCacheInMemory Adding new duplicateID " + describeID(id.getA().bytes, id.getB())); + if (logger.isTraceEnabled()) { + logger.trace("DuplicateIDCacheImpl(" + this.address + ")::addToCacheInMemory Adding new duplicateID " + describeID(id.getA().bytes, id.getB())); } ids.add(id); @@ -303,7 +304,7 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { @Override public void clear() throws Exception { - ActiveMQServerLogger.LOGGER.debug("DuplicateIDCacheImpl(" + this.address + ")::clear removing duplicate ID data"); + logger.debug("DuplicateIDCacheImpl(" + this.address + ")::clear removing duplicate ID data"); synchronized (this) { if (ids.size() > 0) { long tx = storageManager.generateID(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java index 5385782..d91cf15 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java @@ -46,6 +46,7 @@ import org.apache.activemq.artemis.core.io.IOCallback; import org.apache.activemq.artemis.core.message.impl.MessageImpl; import org.apache.activemq.artemis.core.paging.PagingManager; import org.apache.activemq.artemis.core.paging.PagingStore; +import org.apache.activemq.artemis.core.paging.impl.Page; import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.core.postoffice.AddressManager; import org.apache.activemq.artemis.core.postoffice.Binding; @@ -82,6 +83,7 @@ import org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes; import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl; import org.apache.activemq.artemis.utils.TypedProperties; import org.apache.activemq.artemis.utils.UUIDGenerator; +import org.jboss.logging.Logger; /** * This is the class that will make the routing to Queues and decide which consumer will get the messages @@ -89,7 +91,7 @@ import org.apache.activemq.artemis.utils.UUIDGenerator; */ public class PostOfficeImpl implements PostOffice, NotificationListener, BindingsFactory { - private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(Page.class); public static final SimpleString HDR_RESET_QUEUE_DATA = new SimpleString("_AMQ_RESET_QUEUE_DATA"); @@ -220,8 +222,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding if (!(notification.getType() instanceof CoreNotificationType)) return; - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Receiving notification : " + notification + " on server " + this.server); + if (logger.isTraceEnabled()) { + logger.trace("Receiving notification : " + notification + " on server " + this.server); } synchronized (notificationLock) { CoreNotificationType type = (CoreNotificationType) notification.getType(); @@ -256,7 +258,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding SimpleString filterString = props.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING); if (!props.containsProperty(ManagementHelper.HDR_DISTANCE)) { - ActiveMQServerLogger.LOGGER.debug("PostOffice notification / BINDING_ADDED: HDR_DISANCE not specified, giving up propagation on notifications"); + logger.debug("PostOffice notification / BINDING_ADDED: HDR_DISANCE not specified, giving up propagation on notifications"); return; } @@ -272,7 +274,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding TypedProperties props = notification.getProperties(); if (!props.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) { - ActiveMQServerLogger.LOGGER.debug("PostOffice notification / BINDING_REMOVED: HDR_CLUSTER_NAME not specified, giving up propagation on notifications"); + logger.debug("PostOffice notification / BINDING_REMOVED: HDR_CLUSTER_NAME not specified, giving up propagation on notifications"); return; } @@ -281,7 +283,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding QueueInfo info = queueInfos.remove(clusterName); if (info == null) { - ActiveMQServerLogger.LOGGER.debug("PostOffice notification / BINDING_REMOVED: Cannot find queue info for queue \" + clusterName"); + logger.debug("PostOffice notification / BINDING_REMOVED: Cannot find queue info for queue \" + clusterName"); return; } @@ -291,7 +293,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding TypedProperties props = notification.getProperties(); if (!props.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) { - ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CREATED: No clusterName defined"); + logger.debug("PostOffice notification / CONSUMER_CREATED: No clusterName defined"); return; } @@ -302,7 +304,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding QueueInfo info = queueInfos.get(clusterName); if (info == null) { - ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CREATED: Could not find queue created on clusterName = " + clusterName); + logger.debug("PostOffice notification / CONSUMER_CREATED: Could not find queue created on clusterName = " + clusterName); return; } @@ -321,7 +323,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding } if (!props.containsProperty(ManagementHelper.HDR_DISTANCE)) { - ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CREATED: No distance specified"); + logger.debug("PostOffice notification / CONSUMER_CREATED: No distance specified"); return; } @@ -331,7 +333,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding SimpleString queueName = props.getSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME); if (queueName == null) { - ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CREATED: No queue defined"); + logger.debug("PostOffice notification / CONSUMER_CREATED: No queue defined"); return; } @@ -359,7 +361,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding SimpleString clusterName = props.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME); if (clusterName == null) { - ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CLOSED: No cluster name"); + logger.debug("PostOffice notification / CONSUMER_CLOSED: No cluster name"); return; } @@ -381,7 +383,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding if (info.getNumberOfConsumers() == 0) { if (!props.containsProperty(ManagementHelper.HDR_DISTANCE)) { - ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CLOSED: HDR_DISTANCE not defined"); + logger.debug("PostOffice notification / CONSUMER_CLOSED: HDR_DISTANCE not defined"); return; } @@ -391,14 +393,14 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding SimpleString queueName = props.getSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME); if (queueName == null) { - ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CLOSED: No queue name"); + logger.debug("PostOffice notification / CONSUMER_CLOSED: No queue name"); return; } Binding binding = getBinding(queueName); if (binding == null) { - ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CLOSED: Could not find queue " + queueName); + logger.debug("PostOffice notification / CONSUMER_CLOSED: Could not find queue " + queueName); return; } @@ -456,8 +458,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding String uid = UUIDGenerator.getInstance().generateStringUUID(); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("ClusterCommunication::Sending notification for addBinding " + binding + " from server " + server); + if (logger.isDebugEnabled()) { + logger.debug("ClusterCommunication::Sending notification for addBinding " + binding + " from server " + server); } managementService.sendNotification(new Notification(uid, CoreNotificationType.BINDING_ADDED, props)); @@ -647,13 +649,13 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding } else { // this is a debug and not warn because this could be a regular scenario on publish-subscribe queues (or topic subscriptions on JMS) - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Couldn't find any bindings for address=" + address + " on message=" + message); + if (logger.isDebugEnabled()) { + logger.debug("Couldn't find any bindings for address=" + address + " on message=" + message); } } - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("Message after routed=" + message); + if (logger.isTraceEnabled()) { + logger.trace("Message after routed=" + message); } if (context.getQueueCount() == 0) { @@ -668,8 +670,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding SimpleString dlaAddress = addressSettings.getDeadLetterAddress(); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("sending message to dla address = " + dlaAddress + ", message=" + message); + if (logger.isDebugEnabled()) { + logger.debug("sending message to dla address = " + dlaAddress + ", message=" + message); } if (dlaAddress == null) { @@ -688,8 +690,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding else { result = RoutingStatus.NO_BINDINGS; - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Message " + message + " is not going anywhere as it didn't have a binding on address:" + address); + if (logger.isDebugEnabled()) { + logger.debug("Message " + message + " is not going anywhere as it didn't have a binding on address:" + address); } if (message.isLargeMessage()) { @@ -831,8 +833,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding throw new IllegalStateException("Cannot find queue " + queueName); } - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("PostOffice.sendQueueInfoToQueue on server=" + this.server + ", queueName=" + queueName + " and address=" + address); + if (logger.isDebugEnabled()) { + logger.debug("PostOffice.sendQueueInfoToQueue on server=" + this.server + ", queueName=" + queueName + " and address=" + address); } Queue queue = (Queue) binding.getBindable(); @@ -848,8 +850,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding routeQueueInfo(message, queue, false); for (QueueInfo info : queueInfos.values()) { - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("QueueInfo on sendQueueInfoToQueue = " + info); + if (logger.isTraceEnabled()) { + logger.trace("QueueInfo on sendQueueInfoToQueue = " + info); } if (info.matchesAddress(address)) { message = createQueueInfoMessage(CoreNotificationType.BINDING_ADDED, queueName); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java index 0349f4f..bbfdcc1 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java @@ -23,19 +23,21 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.apache.activemq.artemis.api.core.SimpleString; +import org.apache.activemq.artemis.core.paging.impl.Page; import org.apache.activemq.artemis.core.postoffice.Address; import org.apache.activemq.artemis.core.postoffice.AddressManager; import org.apache.activemq.artemis.core.postoffice.Binding; import org.apache.activemq.artemis.core.postoffice.Bindings; import org.apache.activemq.artemis.core.postoffice.BindingsFactory; import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.transaction.Transaction; +import org.jboss.logging.Logger; /** * A simple address manager that maintains the addresses and bindings. */ public class SimpleAddressManager implements AddressManager { + private static final Logger logger = Logger.getLogger(Page.class); /** * HashMap<Address, Binding> @@ -59,8 +61,8 @@ public class SimpleAddressManager implements AddressManager { throw ActiveMQMessageBundle.BUNDLE.bindingAlreadyExists(binding); } - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("Adding binding " + binding + " with address = " + binding.getUniqueName(), new Exception("trace")); + if (logger.isTraceEnabled()) { + logger.trace("Adding binding " + binding + " with address = " + binding.getUniqueName(), new Exception("trace")); } return addMappingInternal(binding.getAddress(), binding); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java index 3285bc1..62c7d99 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java @@ -78,6 +78,7 @@ import org.apache.activemq.artemis.core.server.QueueQueryResult; import org.apache.activemq.artemis.core.server.ServerMessage; import org.apache.activemq.artemis.core.server.ServerSession; import org.apache.activemq.artemis.spi.core.remoting.Connection; +import org.jboss.logging.Logger; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_QUEUE; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_SHARED_QUEUE; @@ -115,7 +116,7 @@ import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SES public class ServerSessionPacketHandler implements ChannelHandler { - private final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(ServerSessionPacketHandler.class); private final ServerSession session; @@ -196,8 +197,8 @@ public class ServerSessionPacketHandler implements ChannelHandler { boolean closeChannel = false; boolean requiresResponse = false; - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("ServerSessionPacketHandler::handlePacket," + packet); + if (logger.isTraceEnabled()) { + logger.trace("ServerSessionPacketHandler::handlePacket," + packet); } try { @@ -486,7 +487,7 @@ public class ServerSessionPacketHandler implements ChannelHandler { catch (ActiveMQIOErrorException e) { getSession().markTXFailed(e); if (requiresResponse) { - ActiveMQServerLogger.LOGGER.debug("Sending exception to client", e); + logger.debug("Sending exception to client", e); response = new ActiveMQExceptionMessage(e); } else { @@ -495,7 +496,7 @@ public class ServerSessionPacketHandler implements ChannelHandler { } catch (ActiveMQXAException e) { if (requiresResponse) { - ActiveMQServerLogger.LOGGER.debug("Sending exception to client", e); + logger.debug("Sending exception to client", e); response = new SessionXAResponseMessage(true, e.errorCode, e.getMessage()); } else { @@ -504,12 +505,12 @@ public class ServerSessionPacketHandler implements ChannelHandler { } catch (ActiveMQException e) { if (requiresResponse) { - ActiveMQServerLogger.LOGGER.debug("Sending exception to client", e); + logger.debug("Sending exception to client", e); response = new ActiveMQExceptionMessage(e); } else { if (e.getType() == ActiveMQExceptionType.QUEUE_EXISTS) { - ActiveMQServerLogger.LOGGER.debug("Caught exception", e); + logger.debug("Caught exception", e); } else { ActiveMQServerLogger.LOGGER.caughtException(e); @@ -540,8 +541,8 @@ public class ServerSessionPacketHandler implements ChannelHandler { final Packet response, final boolean flush, final boolean closeChannel) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("ServerSessionPacketHandler::scheduling response::" + response); + if (logger.isTraceEnabled()) { + logger.trace("ServerSessionPacketHandler::scheduling response::" + response); } storageManager.afterCompleteOperations(new IOCallback() { @@ -553,8 +554,8 @@ public class ServerSessionPacketHandler implements ChannelHandler { doConfirmAndResponse(confirmPacket, exceptionMessage, flush, closeChannel); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("ServerSessionPacketHandler::response sent::" + response); + if (logger.isTraceEnabled()) { + logger.trace("ServerSessionPacketHandler::response sent::" + response); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java index 0e5cd2f..59120d3 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java @@ -25,12 +25,12 @@ import org.apache.activemq.artemis.core.protocol.core.ChannelHandler; import org.apache.activemq.artemis.core.protocol.core.CoreRemotingConnection; import org.apache.activemq.artemis.core.protocol.core.Packet; import org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler; +import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ActiveMQExceptionMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CheckFailoverMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CheckFailoverReplyMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSessionMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSessionResponseMessage; -import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ActiveMQExceptionMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReattachSessionMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReattachSessionResponseMessage; import org.apache.activemq.artemis.core.security.ActiveMQPrincipal; @@ -39,12 +39,15 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.ServerSession; import org.apache.activemq.artemis.core.version.Version; +import org.jboss.logging.Logger; /** * A packet handler for all packets that need to be handled at the server level */ public class ActiveMQPacketHandler implements ChannelHandler { + private static final Logger logger = Logger.getLogger(ActiveMQPacketHandler.class); + private final ActiveMQServer server; private final Channel channel1; @@ -162,7 +165,7 @@ public class ActiveMQPacketHandler implements ChannelHandler { catch (ActiveMQException e) { if (e.getType() == ActiveMQExceptionType.INCOMPATIBLE_CLIENT_SERVER_VERSIONS) { incompatibleVersion = true; - ActiveMQServerLogger.LOGGER.debug("Sending ActiveMQException after Incompatible client", e); + logger.debug("Sending ActiveMQException after Incompatible client", e); } else { ActiveMQServerLogger.LOGGER.failedToCreateSession(e); @@ -196,7 +199,7 @@ public class ActiveMQPacketHandler implements ChannelHandler { response = new ReattachSessionResponseMessage(-1, false); } - ActiveMQServerLogger.LOGGER.debug("Reattaching request from " + connection.getRemoteAddress()); + logger.debug("Reattaching request from " + connection.getRemoteAddress()); ServerSessionPacketHandler sessionHandler = protocolManager.getSessionHandler(request.getName()); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java index 9c5b748..32edb93 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java @@ -50,7 +50,6 @@ import org.apache.activemq.artemis.core.remoting.CloseListener; import org.apache.activemq.artemis.core.remoting.impl.netty.ActiveMQFrameDecoder2; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyServerConnection; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.spi.core.protocol.ConnectionEntry; import org.apache.activemq.artemis.spi.core.protocol.MessageConverter; import org.apache.activemq.artemis.spi.core.protocol.ProtocolManager; @@ -58,10 +57,11 @@ import org.apache.activemq.artemis.spi.core.protocol.ProtocolManagerFactory; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.remoting.Acceptor; import org.apache.activemq.artemis.spi.core.remoting.Connection; +import org.jboss.logging.Logger; public class CoreProtocolManager implements ProtocolManager<Interceptor> { - private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(CoreProtocolManager.class); private final ActiveMQServer server; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java index db61f89..169ea3c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java @@ -36,10 +36,11 @@ import org.apache.activemq.artemis.spi.core.remoting.BufferHandler; import org.apache.activemq.artemis.spi.core.remoting.Connection; import org.apache.activemq.artemis.spi.core.remoting.ReadyListener; import org.apache.activemq.artemis.utils.UUIDGenerator; +import org.jboss.logging.Logger; public class InVMConnection implements Connection { - private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(InVMConnection.class); private final BufferHandler handler; @@ -183,8 +184,8 @@ public class InVMConnection implements Connection { try { if (!closed) { copied.readInt(); // read and discard - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace(InVMConnection.this + "::Sending inVM packet"); + if (logger.isTraceEnabled()) { + logger.trace(InVMConnection.this + "::Sending inVM packet"); } handler.bufferReceived(id, copied); if (futureListener != null) { @@ -199,8 +200,8 @@ public class InVMConnection implements Connection { throw new IllegalStateException(msg, e); } finally { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace(InVMConnection.this + "::packet sent done"); + if (logger.isTraceEnabled()) { + logger.trace(InVMConnection.this + "::packet sent done"); } } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java index 8bcf96c..1a86e47 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java @@ -32,7 +32,6 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.core.server.ActiveMQComponent; import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.spi.core.remoting.AbstractConnector; import org.apache.activemq.artemis.spi.core.remoting.Acceptor; import org.apache.activemq.artemis.spi.core.remoting.BaseConnectionLifeCycleListener; @@ -44,9 +43,12 @@ import org.apache.activemq.artemis.spi.core.remoting.ConnectionLifeCycleListener import org.apache.activemq.artemis.utils.ActiveMQThreadPoolExecutor; import org.apache.activemq.artemis.utils.ConfigurationHelper; import org.apache.activemq.artemis.utils.OrderedExecutorFactory; +import org.jboss.logging.Logger; public class InVMConnector extends AbstractConnector { + private static final Logger logger = Logger.getLogger(InVMConnector.class); + public static final Map<String, Object> DEFAULT_CONFIG; static { @@ -165,7 +167,7 @@ public class InVMConnector extends AbstractConnector { if (InVMConnector.failOnCreateConnection) { InVMConnector.incFailures(); - ActiveMQServerLogger.LOGGER.debug("Returning null on InVMConnector for tests"); + logger.debug("Returning null on InVMConnector for tests"); // For testing only return null; } @@ -181,8 +183,8 @@ public class InVMConnector extends AbstractConnector { return conn; } else { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug(new StringBuilder().append("Connection limit of ").append(acceptor.getConnectionsAllowed()).append(" reached. Refusing connection.")); + if (logger.isDebugEnabled()) { + logger.debug(new StringBuilder().append("Connection limit of ").append(acceptor.getConnectionsAllowed()).append(" reached. Refusing connection.")); } return null; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java index 93fd4ae..9b3329a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java @@ -70,11 +70,12 @@ import org.apache.activemq.artemis.spi.core.remoting.ServerConnectionLifeCycleLi import org.apache.activemq.artemis.utils.ActiveMQThreadFactory; import org.apache.activemq.artemis.utils.ConfigurationHelper; import org.apache.activemq.artemis.utils.ReusableLatch; +import org.jboss.logging.Logger; public class RemotingServiceImpl implements RemotingService, ServerConnectionLifeCycleListener { // Constants ----------------------------------------------------- - private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(RemotingServiceImpl.class); public static final long CONNECTION_TTL_CHECK_INTERVAL = 2000; @@ -314,8 +315,8 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif if (conn.equals(connectionToKeepOpen)) continue; - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("Sending connection.disconnection packet to " + conn); + if (logger.isTraceEnabled()) { + logger.trace("Sending connection.disconnection packet to " + conn); } if (!conn.isClient()) { @@ -335,8 +336,8 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif // We need to stop them accepting first so no new connections are accepted after we send the disconnect message for (Acceptor acceptor : acceptors.values()) { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Pausing acceptor " + acceptor); + if (logger.isDebugEnabled()) { + logger.debug("Pausing acceptor " + acceptor); } try { @@ -348,8 +349,8 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif } - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Sending disconnect on live connections"); + if (logger.isDebugEnabled()) { + logger.debug("Sending disconnect on live connections"); } HashSet<ConnectionEntry> connectionEntries = new HashSet<>(connections.values()); @@ -359,8 +360,8 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif for (ConnectionEntry entry : connectionEntries) { RemotingConnection conn = entry.connection; - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("Sending connection.disconnection packet to " + conn); + if (logger.isTraceEnabled()) { + logger.trace("Sending connection.disconnection packet to " + conn); } conn.disconnect(criticalError); @@ -425,12 +426,12 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif ConnectionEntry entry = connections.remove(remotingConnectionID); if (entry != null) { - ActiveMQServerLogger.LOGGER.debug("RemotingServiceImpl::removing connection ID " + remotingConnectionID); + logger.debug("RemotingServiceImpl::removing connection ID " + remotingConnectionID); connectionCountLatch.countDown(); return entry.connection; } else { - ActiveMQServerLogger.LOGGER.debug("The connectionID::" + remotingConnectionID + " was already removed by some other module"); + logger.debug("The connectionID::" + remotingConnectionID + " was already removed by some other module"); return null; } @@ -473,8 +474,8 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif ConnectionEntry entry = protocol.createConnectionEntry((Acceptor) component, connection); - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Connection created " + connection); + if (logger.isTraceEnabled()) { + logger.trace("Connection created " + connection); } connections.put(connection.getID(), entry); @@ -485,8 +486,8 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif @Override public void connectionDestroyed(final Object connectionID) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Connection removed " + connectionID + " from server " + this.server, new Exception("trace")); + if (logger.isTraceEnabled()) { + logger.trace("Connection removed " + connectionID + " from server " + this.server, new Exception("trace")); } ConnectionEntry conn = connections.get(connectionID); @@ -606,8 +607,8 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif conn.connection.bufferReceived(connectionID, buffer); } else { - if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { - ActiveMQServerLogger.LOGGER.trace("ConnectionID = " + connectionID + " was already closed, so ignoring packet"); + if (logger.isTraceEnabled()) { + logger.trace("ConnectionID = " + connectionID + " was already closed, so ignoring packet"); } } }
