Individualizing logger.traces on org.apache.activemq.artemis.core.server (artemis-server project)

This makes it easier to debug through loggers
This commit is contained in:
Clebert Suconic 2016-04-27 18:01:41 -04:00
parent 2135911eaa
commit f0df9d8c78
65 changed files with 805 additions and 699 deletions

View File

@ -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"));
}
}

View File

@ -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;

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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) {

View File

@ -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);
}

View File

@ -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());
}

View File

@ -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);

View File

@ -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 {

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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());

View File

@ -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;

View File

@ -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");
}
}
}

View File

@ -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;
}

View File

@ -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");
}
}
}

View File

@ -89,7 +89,7 @@ import org.jboss.logging.Logger;
public final class ReplicationEndpoint implements ChannelHandler, ActiveMQComponent {
private static final Logger logger = Logger.getLogger(ReplicationEndpoint.class);
private static final boolean isTrace = logger.isTraceEnabled();
private final IOCriticalErrorListener criticalErrorListener;
private final ActiveMQServerImpl server;
@ -155,7 +155,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
@Override
public void handlePacket(final Packet packet) {
if (isTrace) {
if (logger.isTraceEnabled()) {
logger.trace("handlePacket::handling " + packet);
}
PacketImpl response = new ReplicationResponseMessage();
@ -163,7 +163,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
try {
if (!started) {
if (isTrace) {
if (logger.isTraceEnabled()) {
logger.trace("handlePacket::ignoring " + packet);
}
@ -350,7 +350,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
}
private void finishSynchronization(String liveID) throws Exception {
if (isTrace) {
if (logger.isTraceEnabled()) {
logger.trace("finishSynchronization::" + liveID);
}
for (JournalContent jc : EnumSet.allOf(JournalContent.class)) {
@ -445,7 +445,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
*/
private ReplicationResponseMessageV2 handleStartReplicationSynchronization(final ReplicationStartSyncMessage packet) throws Exception {
if (isTrace) {
if (logger.isTraceEnabled()) {
logger.trace("handleStartReplicationSynchronization:: nodeID = " + packet);
}
ReplicationResponseMessageV2 replicationResponseMessage = new ReplicationResponseMessageV2();
@ -494,7 +494,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
}
private void handleLargeMessageEnd(final ReplicationLargeMessageEndMessage packet) {
if (isTrace) {
if (logger.isTraceEnabled()) {
logger.trace("handleLargeMessageEnd on " + packet.getMessageId());
}
final ReplicatedLargeMessage message = lookupLargeMessage(packet.getMessageId(), true, false);
@ -503,7 +503,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
@Override
public void run() {
try {
if (isTrace) {
if (logger.isTraceEnabled()) {
logger.trace("Deleting LargeMessage " + packet.getMessageId() + " on the executor @ handleLargeMessageEnd");
}
message.deleteFile();
@ -558,7 +558,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
private void handleLargeMessageBegin(final ReplicationLargeMessageBeginMessage packet) {
final long id = packet.getMessageId();
createLargeMessage(id, false);
if (isTrace) {
if (logger.isTraceEnabled()) {
logger.trace("Receiving Large Message Begin " + id + " on backup");
}
}
@ -636,13 +636,13 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
private void handleAppendAddRecord(final ReplicationAddMessage packet) throws Exception {
Journal journalToUse = getJournal(packet.getJournalID());
if (packet.getRecord() == ADD_OPERATION_TYPE.UPDATE) {
if (isTrace) {
if (logger.isTraceEnabled()) {
logger.trace("Endpoint appendUpdate id = " + packet.getId());
}
journalToUse.appendUpdateRecord(packet.getId(), packet.getJournalRecordType(), packet.getRecordData(), noSync);
}
else {
if (isTrace) {
if (logger.isTraceEnabled()) {
logger.trace("Endpoint append id = " + packet.getId());
}
journalToUse.appendAddRecord(packet.getId(), packet.getJournalRecordType(), packet.getRecordData(), noSync);

View File

@ -83,8 +83,7 @@ import org.jboss.logging.Logger;
public final class ReplicationManager implements ActiveMQComponent, ReadyListener {
Logger logger = Logger.getLogger(ReplicationManager.class);
final boolean isTrace = logger.isTraceEnabled();
private static final Logger logger = Logger.getLogger(ReplicationManager.class);
public enum ADD_OPERATION_TYPE {
UPDATE {
@ -584,7 +583,7 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene
public void sendSynchronizationDone(String nodeID, long initialReplicationSyncTimeout) {
if (enabled) {
if (isTrace) {
if (logger.isTraceEnabled()) {
logger.trace("sendSynchronizationDone ::" + nodeID + ", " + initialReplicationSyncTimeout);
}
@ -596,7 +595,7 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene
}
}
catch (InterruptedException e) {
ActiveMQServerLogger.LOGGER.debug(e);
logger.debug(e);
}
inSync = false;
}
@ -627,9 +626,9 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene
* @return
*/
public OperationContext sendLiveIsStopping(final LiveStopping finalMessage) {
ActiveMQServerLogger.LOGGER.debug("LIVE IS STOPPING?!? message=" + finalMessage + " enabled=" + enabled);
logger.debug("LIVE IS STOPPING?!? message=" + finalMessage + " enabled=" + enabled);
if (enabled) {
ActiveMQServerLogger.LOGGER.debug("LIVE IS STOPPING?!? message=" + finalMessage + " " + enabled);
logger.debug("LIVE IS STOPPING?!? message=" + finalMessage + " " + enabled);
return sendReplicatePacket(new ReplicationLiveIsStoppingMessage(finalMessage));
}
return null;

View File

@ -29,7 +29,6 @@ import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.security.SecurityAuth;
import org.apache.activemq.artemis.core.security.SecurityStore;
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.management.Notification;
import org.apache.activemq.artemis.core.server.management.NotificationService;
import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
@ -38,18 +37,14 @@ import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager2;
import org.apache.activemq.artemis.utils.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.TypedProperties;
import org.jboss.logging.Logger;
/**
* The ActiveMQ Artemis SecurityStore implementation
*/
public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryChangeListener {
// Constants -----------------------------------------------------
// Static --------------------------------------------------------
// Attributes ----------------------------------------------------
private final boolean trace = ActiveMQServerLogger.LOGGER.isTraceEnabled();
private static final Logger logger = Logger.getLogger(SecurityStoreImpl.class);
private final HierarchicalRepository<Set<Role>> securityRepository;
@ -108,8 +103,8 @@ public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryC
if (securityEnabled) {
if (managementClusterUser.equals(user)) {
if (trace) {
ActiveMQServerLogger.LOGGER.trace("Authenticating cluster admin user");
if (logger.isTraceEnabled()) {
logger.trace("Authenticating cluster admin user");
}
/*
@ -152,8 +147,8 @@ public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryC
final CheckType checkType,
final SecurityAuth session) throws Exception {
if (securityEnabled) {
if (trace) {
ActiveMQServerLogger.LOGGER.trace("checking access permissions to " + address);
if (logger.isTraceEnabled()) {
logger.trace("checking access permissions to " + address);
}
String user = session.getUsername();

View File

@ -17,6 +17,7 @@
package org.apache.activemq.artemis.core.server;
import org.apache.activemq.artemis.utils.SizeFormatterUtil;
import org.jboss.logging.Logger;
/**
* A memory usage watcher.
@ -26,6 +27,8 @@ import org.apache.activemq.artemis.utils.SizeFormatterUtil;
*/
public class MemoryManager implements ActiveMQComponent {
private static final Logger logger = Logger.getLogger(MemoryManager.class);
private final Runtime runtime;
private final long measureInterval;
@ -57,7 +60,7 @@ public class MemoryManager implements ActiveMQComponent {
@Override
public synchronized void start() {
ActiveMQServerLogger.LOGGER.debug("Starting MemoryManager with MEASURE_INTERVAL: " + measureInterval +
logger.debug("Starting MemoryManager with MEASURE_INTERVAL: " + measureInterval +
" FREE_MEMORY_PERCENT: " +
memoryWarningThreshold);
@ -127,8 +130,8 @@ public class MemoryManager implements ActiveMQComponent {
info.append(String.format("total memory: %s%n", SizeFormatterUtil.sizeof(totalMemory)));
info.append(String.format("available memory: %.2f%%%n", availableMemoryPercent));
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug(info);
if (logger.isDebugEnabled()) {
logger.debug(info);
}
if (availableMemoryPercent <= memoryWarningThreshold) {

View File

@ -37,12 +37,15 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.NodeManager;
import org.apache.activemq.artemis.utils.ExecutorFactory;
import org.jboss.logging.Logger;
/*
* takes care of updating the cluster with a backups transport configuration which is based on each cluster connection.
* */
public class BackupManager implements ActiveMQComponent {
private static final Logger logger = Logger.getLogger(BackupManager.class);
private ActiveMQServer server;
private Executor executor;
private ScheduledExecutorService scheduledExecutor;
@ -236,8 +239,8 @@ public class BackupManager implements ActiveMQComponent {
ActiveMQServerLogger.LOGGER.error("Error announcing backup: backupServerLocator is null. " + this);
return;
}
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug(BackupConnector.this + ":: announcing " + connector + " to " + backupServerLocator);
if (logger.isDebugEnabled()) {
logger.debug(BackupConnector.this + ":: announcing " + connector + " to " + backupServerLocator);
}
announcingBackup = true;
//connect to the cluster
@ -337,8 +340,8 @@ public class BackupManager implements ActiveMQComponent {
@Override
public ServerLocatorInternal createServerLocator(Topology topology) {
if (tcConfigs != null && tcConfigs.length > 0) {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug(BackupManager.this + "Creating a serverLocator for " + Arrays.toString(tcConfigs));
if (logger.isDebugEnabled()) {
logger.debug(BackupManager.this + "Creating a serverLocator for " + Arrays.toString(tcConfigs));
}
ServerLocatorImpl locator = new ServerLocatorImpl(topology, true, tcConfigs);
locator.setClusterConnection(true);

View File

@ -29,8 +29,8 @@ import org.apache.activemq.artemis.api.core.Interceptor;
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.ServerLocator;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
@ -56,13 +56,14 @@ import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteHandler;
import org.apache.activemq.artemis.core.server.cluster.qourum.Vote;
import org.apache.activemq.artemis.core.server.impl.Activation;
import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
import org.jboss.logging.Logger;
/**
* used for creating and managing cluster control connections for each cluster connection and the replication connection
*/
public class ClusterController implements ActiveMQComponent {
private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled();
private static final Logger logger = Logger.getLogger(ClusterController.class);
private final QuorumManager quorumManager;
@ -348,8 +349,8 @@ public class ClusterController implements ActiveMQComponent {
else {
pair = new Pair<>(msg.getConnector(), msg.getBackupConnector());
}
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("Server " + server + " receiving nodeUp from NodeID=" + msg.getNodeID() + ", pair=" + pair);
if (logger.isTraceEnabled()) {
logger.trace("Server " + server + " receiving nodeUp from NodeID=" + msg.getNodeID() + ", pair=" + pair);
}
if (acceptorUsed != null) {
@ -359,11 +360,11 @@ public class ClusterController implements ActiveMQComponent {
clusterConn.nodeAnnounced(msg.getCurrentEventID(), msg.getNodeID(), msg.getBackupGroupName(), scaleDownGroupName, pair, msg.isBackup());
}
else {
ActiveMQServerLogger.LOGGER.debug("Cluster connection is null on acceptor = " + acceptorUsed);
logger.debug("Cluster connection is null on acceptor = " + acceptorUsed);
}
}
else {
ActiveMQServerLogger.LOGGER.debug("there is no acceptor used configured at the CoreProtocolManager " + this);
logger.debug("there is no acceptor used configured at the CoreProtocolManager " + this);
}
}
else if (packet.getType() == PacketImpl.QUORUM_VOTE) {

View File

@ -65,6 +65,7 @@ import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
import org.apache.activemq.artemis.utils.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.ExecutorFactory;
import org.apache.activemq.artemis.utils.FutureLatch;
import org.jboss.logging.Logger;
/**
* A ClusterManager manages {@link ClusterConnection}s, {@link BroadcastGroup}s and {@link Bridge}s.
@ -75,6 +76,8 @@ import org.apache.activemq.artemis.utils.FutureLatch;
*/
public final class ClusterManager implements ActiveMQComponent {
private static final Logger logger = Logger.getLogger(ClusterManager.class);
private ClusterController clusterController;
private HAManager haManager;
@ -474,7 +477,7 @@ public final class ClusterManager implements ActiveMQComponent {
serverLocator.addIncomingInterceptor(new IncomingInterceptorLookingForExceptionMessage(this, executor));
if (!config.isUseDuplicateDetection()) {
ActiveMQServerLogger.LOGGER.debug("Bridge " + config.getName() +
logger.debug("Bridge " + config.getName() +
" is configured to not use duplicate detecion, it will send messages synchronously");
}
@ -605,8 +608,8 @@ public final class ClusterManager implements ActiveMQComponent {
if (dg == null)
return;
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug(this + " Starting a Discovery Group Cluster Connection, name=" +
if (logger.isDebugEnabled()) {
logger.debug(this + " Starting a Discovery Group Cluster Connection, name=" +
config.getDiscoveryGroupName() +
", dg=" +
dg);
@ -619,8 +622,8 @@ public final class ClusterManager implements ActiveMQComponent {
else {
TransportConfiguration[] tcConfigs = config.getTransportConfigurations(configuration);
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug(this + " defining cluster connection towards " + Arrays.toString(tcConfigs));
if (logger.isDebugEnabled()) {
logger.debug(this + " defining cluster connection towards " + Arrays.toString(tcConfigs));
}
clusterConnection = new ClusterConnectionImpl(this, tcConfigs, connector, new SimpleString(config.getName()), new SimpleString(config.getAddress()), config.getMinLargeMessageSize(), config.getClientFailureCheckPeriod(), config.getConnectionTTL(), config.getRetryInterval(), config.getRetryIntervalMultiplier(), config.getMaxRetryInterval(), config.getInitialConnectAttempts(), config.getReconnectAttempts(), config.getCallTimeout(), config.getCallFailoverTimeout(), config.isDuplicateDetection(), config.getMessageLoadBalancingType(), config.getConfirmationWindowSize(), executorFactory, server, postOffice, managementService, scheduledExecutor, config.getMaxHops(), nodeManager, server.getConfiguration().getClusterUser(), server.getConfiguration().getClusterPassword(), config.isAllowDirectConnectionsOnly(), config.getClusterNotificationInterval(), config.getClusterNotificationAttempts());
@ -637,8 +640,8 @@ public final class ClusterManager implements ActiveMQComponent {
clusterConnections.put(config.getName(), clusterConnection);
if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
ActiveMQServerLogger.LOGGER.trace("ClusterConnection.start at " + clusterConnection, new Exception("trace"));
if (logger.isTraceEnabled()) {
logger.trace("ClusterConnection.start at " + clusterConnection, new Exception("trace"));
}
}

View File

@ -65,6 +65,7 @@ import org.apache.activemq.artemis.utils.FutureLatch;
import org.apache.activemq.artemis.utils.ReusableLatch;
import org.apache.activemq.artemis.utils.TypedProperties;
import org.apache.activemq.artemis.utils.UUID;
import org.jboss.logging.Logger;
/**
* A Core BridgeImpl
@ -73,7 +74,7 @@ import org.apache.activemq.artemis.utils.UUID;
public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowledgementHandler, ReadyListener {
// Constants -----------------------------------------------------
private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled();
private static final Logger logger = Logger.getLogger(BridgeImpl.class);
// Attributes ----------------------------------------------------
@ -282,12 +283,12 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
refs.clear();
}
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("BridgeImpl::cancelRefs cancelling " + list.size() + " references");
if (logger.isTraceEnabled()) {
logger.trace("BridgeImpl::cancelRefs cancelling " + list.size() + " references");
}
if (isTrace && list.isEmpty()) {
ActiveMQServerLogger.LOGGER.trace("didn't have any references to cancel on bridge " + this);
if (logger.isTraceEnabled() && list.isEmpty()) {
logger.trace("didn't have any references to cancel on bridge " + this);
return;
}
@ -300,8 +301,8 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
while (listIterator.hasPrevious()) {
MessageReference ref = listIterator.previous();
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("BridgeImpl::cancelRefs Cancelling reference " + ref + " on bridge " + this);
if (logger.isTraceEnabled()) {
logger.trace("BridgeImpl::cancelRefs Cancelling reference " + ref + " on bridge " + this);
}
refqueue = ref.getQueue();
@ -340,7 +341,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
session.cleanUp(false);
}
catch (Exception dontcare) {
ActiveMQServerLogger.LOGGER.debug(dontcare.getMessage(), dontcare);
logger.debug(dontcare.getMessage(), dontcare);
}
session = null;
}
@ -349,7 +350,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
sessionConsumer.cleanUp(false);
}
catch (Exception dontcare) {
ActiveMQServerLogger.LOGGER.debug(dontcare.getMessage(), dontcare);
logger.debug(dontcare.getMessage(), dontcare);
}
sessionConsumer = null;
}
@ -378,8 +379,8 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
stopping = true;
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Bridge " + this.name + " being stopped");
if (logger.isDebugEnabled()) {
logger.debug("Bridge " + this.name + " being stopped");
}
if (futureScheduledReconnection != null) {
@ -403,8 +404,8 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
@Override
public void pause() throws Exception {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Bridge " + this.name + " being paused");
if (logger.isDebugEnabled()) {
logger.debug("Bridge " + this.name + " being paused");
}
executor.execute(new PauseRunnable());
@ -474,8 +475,8 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
@Override
public void sendAcknowledged(final Message message) {
if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
ActiveMQServerLogger.LOGGER.trace("BridgeImpl::sendAcknowledged received confirmation for message " + message);
if (logger.isTraceEnabled()) {
logger.trace("BridgeImpl::sendAcknowledged received confirmation for message " + message);
}
if (active) {
try {
@ -487,15 +488,15 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
}
if (ref != null) {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("BridgeImpl::sendAcknowledged bridge " + this + " Acking " + ref + " on queue " + ref.getQueue());
if (logger.isTraceEnabled()) {
logger.trace("BridgeImpl::sendAcknowledged bridge " + this + " Acking " + ref + " on queue " + ref.getQueue());
}
ref.getQueue().acknowledge(ref);
pendingAcks.countDown();
}
else {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("BridgeImpl::sendAcknowledged bridge " + this + " could not find reference for message " + message);
if (logger.isTraceEnabled()) {
logger.trace("BridgeImpl::sendAcknowledged bridge " + this + " could not find reference for message " + message);
}
}
}
@ -521,8 +522,8 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
if (transformer != null) {
final ServerMessage transformedMessage = transformer.transform(message);
if (transformedMessage != message) {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("The transformer " + transformer +
if (logger.isDebugEnabled()) {
logger.debug("The transformer " + transformer +
" made a copy of the message " +
message +
" as transformedMessage");
@ -548,8 +549,8 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
synchronized (this) {
if (!active || !session.isWritable(this)) {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug(this + "::Ignoring reference on bridge as it is set to inactive ref=" + ref);
if (logger.isDebugEnabled()) {
logger.debug(this + "::Ignoring reference on bridge as it is set to inactive ref=" + ref);
}
return HandleStatus.BUSY;
}
@ -558,8 +559,8 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
return HandleStatus.BUSY;
}
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("Bridge " + this + " is handling reference=" + ref);
if (logger.isTraceEnabled()) {
logger.trace("Bridge " + this + " is handling reference=" + ref);
}
ref.handled();
@ -639,7 +640,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
if (scaleDownTargetNodeID != null && !scaleDownTargetNodeID.equals(nodeUUID.toString())) {
synchronized (this) {
try {
ActiveMQServerLogger.LOGGER.debug("Moving " + queue.getMessageCount() + " messages from " + queue.getName() + " to " + scaleDownTargetNodeID);
logger.debug("Moving " + queue.getMessageCount() + " messages from " + queue.getName() + " to " + scaleDownTargetNodeID);
((QueueImpl) queue).moveReferencesBetweenSnFQueues(SimpleString.toSimpleString(scaleDownTargetNodeID));
// stop the bridge from trying to reconnect and clean up all the bindings
@ -652,11 +653,11 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
}
else if (scaleDownTargetNodeID != null) {
// the disconnected node is scaling down to me, no need to reconnect to it
ActiveMQServerLogger.LOGGER.debug("Received scaleDownTargetNodeID: " + scaleDownTargetNodeID + "; cancelling reconnect.");
logger.debug("Received scaleDownTargetNodeID: " + scaleDownTargetNodeID + "; cancelling reconnect.");
fail(true);
}
else {
ActiveMQServerLogger.LOGGER.debug("Received invalid scaleDownTargetNodeID: " + scaleDownTargetNodeID);
logger.debug("Received invalid scaleDownTargetNodeID: " + scaleDownTargetNodeID);
fail(me.getType() == ActiveMQExceptionType.DISCONNECTED);
}
@ -713,8 +714,8 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
// from the acks so it will get resent, duplicate detection will cope
// with any messages resent
if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
ActiveMQServerLogger.LOGGER.trace("going to send message: " + message + " from " + this.getQueue());
if (logger.isTraceEnabled()) {
logger.trace("going to send message: " + message + " from " + this.getQueue());
}
try {
@ -780,17 +781,17 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
}
protected void fail(final boolean permanently) {
ActiveMQServerLogger.LOGGER.debug(this + "\n\t::fail being called, permanently=" + permanently);
logger.debug(this + "\n\t::fail being called, permanently=" + permanently);
if (queue != null) {
try {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("Removing consumer on fail " + this + " from queue " + queue);
if (logger.isTraceEnabled()) {
logger.trace("Removing consumer on fail " + this + " from queue " + queue);
}
queue.removeConsumer(this);
}
catch (Exception dontcare) {
ActiveMQServerLogger.LOGGER.debug(dontcare);
logger.debug(dontcare);
}
}
@ -866,7 +867,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
if (!keepConnecting)
return;
ActiveMQServerLogger.LOGGER.debug("Connecting " + this + " to its destination [" + nodeUUID.toString() + "], csf=" + this.csf);
logger.debug("Connecting " + this + " to its destination [" + nodeUUID.toString() + "], csf=" + this.csf);
retryCount++;
@ -948,8 +949,8 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
return;
}
else {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Bridge " + this + " is unable to connect to destination. Retrying", e);
if (logger.isDebugEnabled()) {
logger.debug("Bridge " + this + " is unable to connect to destination. Retrying", e);
}
scheduleRetryConnect();
@ -1002,7 +1003,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
timeout = maxRetryInterval;
}
ActiveMQServerLogger.LOGGER.debug("Bridge " + this +
logger.debug("Bridge " + this +
" retrying connection #" +
retryCount +
", maxRetry=" +
@ -1025,8 +1026,8 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
if (stopping)
return;
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Scheduling retry for bridge " + this.name + " in " + milliseconds + " milliseconds");
if (logger.isDebugEnabled()) {
logger.debug("Scheduling retry for bridge " + this.name + " in " + milliseconds + " milliseconds");
}
futureScheduledReconnection = scheduledExecutor.schedule(new FutureConnectRunnable(executor, this), milliseconds, TimeUnit.MILLISECONDS);
@ -1085,7 +1086,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
@Override
public void run() {
try {
ActiveMQServerLogger.LOGGER.debug("stopping bridge " + BridgeImpl.this);
logger.debug("stopping bridge " + BridgeImpl.this);
queue.removeConsumer(BridgeImpl.this);
if (!pendingAcks.await(10, TimeUnit.SECONDS)) {
@ -1093,7 +1094,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
}
synchronized (BridgeImpl.this) {
ActiveMQServerLogger.LOGGER.debug("Closing Session for bridge " + BridgeImpl.this.name);
logger.debug("Closing Session for bridge " + BridgeImpl.this.name);
started = false;
@ -1102,7 +1103,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
}
if (session != null) {
ActiveMQServerLogger.LOGGER.debug("Cleaning up session " + session);
logger.debug("Cleaning up session " + session);
session.removeFailureListener(BridgeImpl.this);
try {
session.close();
@ -1113,7 +1114,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
}
if (sessionConsumer != null) {
ActiveMQServerLogger.LOGGER.debug("Cleaning up session " + session);
logger.debug("Cleaning up session " + session);
try {
sessionConsumer.close();
sessionConsumer = null;
@ -1132,8 +1133,8 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled
keepConnecting = true;
}
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("Removing consumer on stopRunnable " + this + " from queue " + queue);
if (logger.isTraceEnabled()) {
logger.trace("Removing consumer on stopRunnable " + this + " from queue " + queue);
}
ActiveMQServerLogger.LOGGER.bridgeStopped(name);
}

View File

@ -36,6 +36,7 @@ import org.apache.activemq.artemis.core.server.management.Notification;
import org.apache.activemq.artemis.core.server.management.NotificationService;
import org.apache.activemq.artemis.utils.TypedProperties;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.jboss.logging.Logger;
/**
* <p>This class will use the {@link BroadcastEndpoint} to send periodical updates on the list for connections
@ -46,6 +47,8 @@ import org.apache.activemq.artemis.utils.UUIDGenerator;
*/
public class BroadcastGroupImpl implements BroadcastGroup, Runnable {
private static final Logger logger = Logger.getLogger(BroadcastGroupImpl.class);
private final NodeManager nodeManager;
private final String name;
@ -215,7 +218,7 @@ public class BroadcastGroupImpl implements BroadcastGroup, Runnable {
loggedBroadcastException = true;
}
else {
ActiveMQServerLogger.LOGGER.debug("Failed to broadcast connector configs...again", e);
logger.debug("Failed to broadcast connector configs...again", e);
}
}
}

View File

@ -33,7 +33,6 @@ import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
import org.apache.activemq.artemis.api.core.management.ManagementHelper;
import org.apache.activemq.artemis.api.core.management.ResourceNames;
import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal;
import org.apache.activemq.artemis.core.filter.Filter;
@ -50,6 +49,7 @@ import org.apache.activemq.artemis.core.server.cluster.MessageFlowRecord;
import org.apache.activemq.artemis.core.server.cluster.Transformer;
import org.apache.activemq.artemis.utils.UUID;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.jboss.logging.Logger;
/**
* A bridge with extra functionality only available when the server is clustered.
@ -57,6 +57,7 @@ import org.apache.activemq.artemis.utils.UUIDGenerator;
* Such as such adding extra properties and setting up notifications between the nodes.
*/
public class ClusterConnectionBridge extends BridgeImpl {
private static final Logger logger = Logger.getLogger(ClusterConnectionBridge.class);
private final ClusterConnection clusterConnection;
@ -123,8 +124,8 @@ public class ClusterConnectionBridge extends BridgeImpl {
// we need to disable DLQ check on the clustered bridges
queue.setInternalQueue(true);
if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
ActiveMQServerLogger.LOGGER.trace("Setting up bridge between " + clusterConnection.getConnector() + " and " + targetLocator, new Exception("trace"));
if (logger.isTraceEnabled()) {
logger.trace("Setting up bridge between " + clusterConnection.getConnector() + " and " + targetLocator, new Exception("trace"));
}
}
@ -151,8 +152,8 @@ public class ClusterConnectionBridge extends BridgeImpl {
// Note we must copy since same message may get routed to other nodes which require different headers
ServerMessage messageCopy = message.copy();
if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
ActiveMQServerLogger.LOGGER.trace("Clustered bridge copied message " + message + " as " + messageCopy + " before delivery");
if (logger.isTraceEnabled()) {
logger.trace("Clustered bridge copied message " + message + " as " + messageCopy + " before delivery");
}
// TODO - we can optimise this
@ -181,8 +182,8 @@ public class ClusterConnectionBridge extends BridgeImpl {
}
private void setupNotificationConsumer() throws Exception {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Setting up notificationConsumer between " + this.clusterConnection.getConnector() +
if (logger.isDebugEnabled()) {
logger.debug("Setting up notificationConsumer between " + this.clusterConnection.getConnector() +
" and " +
flowRecord.getBridge().getForwardingConnection() +
" clusterConnection = " +
@ -195,7 +196,7 @@ public class ClusterConnectionBridge extends BridgeImpl {
if (notifConsumer != null) {
try {
ActiveMQServerLogger.LOGGER.debug("Closing notification Consumer for reopening " + notifConsumer +
logger.debug("Closing notification Consumer for reopening " + notifConsumer +
" on bridge " +
this.getName());
notifConsumer.close();
@ -250,14 +251,14 @@ public class ClusterConnectionBridge extends BridgeImpl {
sessionConsumer.start();
ClientMessage message = sessionConsumer.createMessage(false);
if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) {
ActiveMQClientLogger.LOGGER.trace("Requesting sendQueueInfoToQueue through " + this, new Exception("trace"));
if (logger.isTraceEnabled()) {
logger.trace("Requesting sendQueueInfoToQueue through " + this, new Exception("trace"));
}
ManagementHelper.putOperationInvocation(message, ResourceNames.CORE_SERVER, "sendQueueInfoToQueue", notifQueueName.toString(), flowRecord.getAddress());
try (ClientProducer prod = sessionConsumer.createProducer(managementAddress)) {
if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) {
ActiveMQClientLogger.LOGGER.debug("Cluster connection bridge on " + clusterConnection + " requesting information on queues");
if (logger.isDebugEnabled()) {
logger.debug("Cluster connection bridge on " + clusterConnection + " requesting information on queues");
}
prod.send(message);
@ -348,11 +349,11 @@ public class ClusterConnectionBridge extends BridgeImpl {
@Override
protected void fail(final boolean permanently) {
ActiveMQServerLogger.LOGGER.debug("Cluster Bridge " + this.getName() + " failed, permanently=" + permanently);
logger.debug("Cluster Bridge " + this.getName() + " failed, permanently=" + permanently);
super.fail(permanently);
if (permanently) {
ActiveMQServerLogger.LOGGER.debug("cluster node for bridge " + this.getName() + " is permanently down");
logger.debug("cluster node for bridge " + this.getName() + " is permanently down");
clusterConnection.removeRecord(targetNodeID);
}
else {

View File

@ -54,12 +54,12 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.NodeManager;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory;
import org.apache.activemq.artemis.core.server.cluster.Bridge;
import org.apache.activemq.artemis.core.server.cluster.ClusterConnection;
import org.apache.activemq.artemis.core.server.cluster.ClusterControl;
import org.apache.activemq.artemis.core.server.cluster.ClusterManager;
import org.apache.activemq.artemis.core.server.cluster.ClusterManager.IncomingInterceptorLookingForExceptionMessage;
import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory;
import org.apache.activemq.artemis.core.server.cluster.MessageFlowRecord;
import org.apache.activemq.artemis.core.server.cluster.RemoteQueueBinding;
import org.apache.activemq.artemis.core.server.group.impl.Proposal;
@ -70,16 +70,17 @@ import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.utils.ExecutorFactory;
import org.apache.activemq.artemis.utils.FutureLatch;
import org.apache.activemq.artemis.utils.TypedProperties;
import org.jboss.logging.Logger;
public final class ClusterConnectionImpl implements ClusterConnection, AfterConnectInternalListener {
private static final Logger logger = Logger.getLogger(ClusterConnectionImpl.class);
/** When getting member on node-up and down we have to remove the name from the transport config
* as the setting we build here doesn't need to consider the name, so use the same name on all
* the instances. */
private static final String TRANSPORT_CONFIG_NAME = "topology-member";
private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled();
private final ExecutorFactory executorFactory;
private final Executor executor;
@ -396,15 +397,15 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
return;
}
stopping = true;
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug(this + "::stopping ClusterConnection");
if (logger.isDebugEnabled()) {
logger.debug(this + "::stopping ClusterConnection");
}
if (serverLocator != null) {
serverLocator.removeClusterTopologyListener(this);
}
ActiveMQServerLogger.LOGGER.debug("Cluster connection being stopped for node" + nodeManager.getNodeId() +
logger.debug("Cluster connection being stopped for node" + nodeManager.getNodeId() +
", server = " +
this.server +
" serverLocator = " +
@ -474,8 +475,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
final String scaleDownGroupName,
final Pair<TransportConfiguration, TransportConfiguration> connectorPair,
final boolean backup) {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug(this + "::NodeAnnounced, backup=" + backup + nodeID + connectorPair);
if (logger.isDebugEnabled()) {
logger.debug(this + "::NodeAnnounced, backup=" + backup + nodeID + connectorPair);
}
TransportConfiguration live = connectorPair.getA();
@ -563,8 +564,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
return;
}
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Activating cluster connection nodeID=" + nodeManager.getNodeId() + " for server=" + this.server);
if (logger.isDebugEnabled()) {
logger.debug("Activating cluster connection nodeID=" + nodeManager.getNodeId() + " for server=" + this.server);
}
liveNotifier = new LiveNotifier();
@ -576,7 +577,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
if (serverLocator != null) {
if (!useDuplicateDetection) {
ActiveMQServerLogger.LOGGER.debug("DuplicateDetection is disabled, sending clustered messages blocked");
logger.debug("DuplicateDetection is disabled, sending clustered messages blocked");
}
final TopologyMember currentMember = topology.getMember(manager.getNodeId());
@ -618,7 +619,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(new SimpleString("name"), name);
Notification notification = new Notification(nodeManager.getNodeId().toString(), CoreNotificationType.CLUSTER_CONNECTION_STARTED, props);
ActiveMQServerLogger.LOGGER.debug("sending notification: " + notification);
logger.debug("sending notification: " + notification);
managementService.sendNotification(notification);
}
//we add as a listener after we have sent the cluster start notif as the listener may start sending notifs before
@ -646,15 +647,15 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
return;
}
final String nodeID = topologyMember.getNodeId();
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
if (logger.isDebugEnabled()) {
String ClusterTestBase = "receiving nodeUP for nodeID=";
ActiveMQServerLogger.LOGGER.debug(this + ClusterTestBase + nodeID + " connectionPair=" + topologyMember);
logger.debug(this + ClusterTestBase + nodeID + " connectionPair=" + topologyMember);
}
// discard notifications about ourselves unless its from our backup
if (nodeID.equals(nodeManager.getNodeId().toString())) {
if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
ActiveMQServerLogger.LOGGER.trace(this + "::informing about backup to itself, nodeUUID=" +
if (logger.isTraceEnabled()) {
logger.trace(this + "::informing about backup to itself, nodeUUID=" +
nodeManager.getNodeId() + ", connectorPair=" + topologyMember + ", this = " + this);
}
return;
@ -672,8 +673,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
}
/*we don't create bridges to backups*/
if (topologyMember.getLive() == null) {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace(this + " ignoring call with nodeID=" + nodeID + ", topologyMember=" +
if (logger.isTraceEnabled()) {
logger.trace(this + " ignoring call with nodeID=" + nodeID + ", topologyMember=" +
topologyMember + ", last=" + last);
}
return;
@ -684,8 +685,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
MessageFlowRecord record = records.get(nodeID);
if (record == null) {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug(this + "::Creating record for nodeID=" + nodeID + ", topologyMember=" +
if (logger.isDebugEnabled()) {
logger.debug(this + "::Creating record for nodeID=" + nodeID + ", topologyMember=" +
topologyMember);
}
@ -713,8 +714,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
createNewRecord(topologyMember.getUniqueEventID(), nodeID, topologyMember.getLive(), queueName, queue, true);
}
else {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace(this + " ignored nodeUp record for " + topologyMember + " on nodeID=" +
if (logger.isTraceEnabled()) {
logger.trace(this + " ignored nodeUp record for " + topologyMember + " on nodeID=" +
nodeID + " as the record already existed");
}
}
@ -795,8 +796,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
targetLocator.setIdentity("(Cluster-connection-bridge::" + bridge.toString() + "::" + this.toString() + ")");
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("creating record between " + this.connector + " and " + connector + bridge);
if (logger.isDebugEnabled()) {
logger.debug("creating record between " + this.connector + " and " + connector + bridge);
}
record.setBridge(bridge);
@ -923,8 +924,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
* */
@Override
public void close() throws Exception {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("Stopping bridge " + bridge);
if (logger.isTraceEnabled()) {
logger.trace("Stopping bridge " + bridge);
}
isClosed = true;
@ -949,7 +950,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
}
}
catch (Exception ignored) {
ActiveMQServerLogger.LOGGER.debug(ignored.getMessage(), ignored);
logger.debug(ignored.getMessage(), ignored);
}
}
});
@ -976,8 +977,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
@Override
public synchronized void onMessage(final ClientMessage message) {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("ClusterCommunication::Flow record on " + clusterConnector + " Receiving message " + message);
if (logger.isDebugEnabled()) {
logger.debug("ClusterCommunication::Flow record on " + clusterConnector + " Receiving message " + message);
}
try {
// Reset the bindings
@ -992,7 +993,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
}
if (!reset) {
ActiveMQServerLogger.LOGGER.debug("Notification being ignored since first reset wasn't received yet: " + message);
logger.debug("Notification being ignored since first reset wasn't received yet: " + message);
return;
}
@ -1121,21 +1122,21 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
}
private synchronized void clearBindings() throws Exception {
ActiveMQServerLogger.LOGGER.debug(ClusterConnectionImpl.this + " clearing bindings");
logger.debug(ClusterConnectionImpl.this + " clearing bindings");
for (RemoteQueueBinding binding : new HashSet<>(bindings.values())) {
removeBinding(binding.getClusterName());
}
}
private synchronized void resetBindings() throws Exception {
ActiveMQServerLogger.LOGGER.debug(ClusterConnectionImpl.this + " reset bindings");
logger.debug(ClusterConnectionImpl.this + " reset bindings");
for (RemoteQueueBinding binding : new HashSet<>(bindings.values())) {
resetBinding(binding.getClusterName());
}
}
private synchronized void clearDisconnectedBindings() throws Exception {
ActiveMQServerLogger.LOGGER.debug(ClusterConnectionImpl.this + " reset bindings");
logger.debug(ClusterConnectionImpl.this + " reset bindings");
for (RemoteQueueBinding binding : new HashSet<>(bindings.values())) {
if (!binding.isConnected()) {
removeBinding(binding.getClusterName());
@ -1145,7 +1146,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
@Override
public synchronized void disconnectBindings() throws Exception {
ActiveMQServerLogger.LOGGER.debug(ClusterConnectionImpl.this + " disconnect bindings");
logger.debug(ClusterConnectionImpl.this + " disconnect bindings");
reset = false;
for (RemoteQueueBinding binding : new HashSet<>(bindings.values())) {
disconnectBinding(binding.getClusterName());
@ -1153,8 +1154,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
}
private synchronized void doBindingAdded(final ClientMessage message) throws Exception {
if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
ActiveMQServerLogger.LOGGER.trace(ClusterConnectionImpl.this + " Adding binding " + message);
if (logger.isTraceEnabled()) {
logger.trace(ClusterConnectionImpl.this + " Adding binding " + message);
}
if (!message.containsProperty(ManagementHelper.HDR_DISTANCE)) {
throw new IllegalStateException("distance is null");
@ -1206,8 +1207,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
RemoteQueueBinding binding = new RemoteQueueBindingImpl(server.getStorageManager().generateID(), queueAddress, clusterName, routingName, queueID, filterString, queue, bridge.getName(), distance + 1);
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("Adding binding " + clusterName + " into " + ClusterConnectionImpl.this);
if (logger.isTraceEnabled()) {
logger.trace("Adding binding " + clusterName + " into " + ClusterConnectionImpl.this);
}
bindings.put(clusterName, binding);
@ -1225,8 +1226,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
}
private void doBindingRemoved(final ClientMessage message) throws Exception {
if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
ActiveMQServerLogger.LOGGER.trace(ClusterConnectionImpl.this + " Removing binding " + message);
if (logger.isTraceEnabled()) {
logger.trace(ClusterConnectionImpl.this + " Removing binding " + message);
}
if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) {
throw new IllegalStateException("clusterName is null");
@ -1266,8 +1267,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
}
private synchronized void doConsumerCreated(final ClientMessage message) throws Exception {
if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
ActiveMQServerLogger.LOGGER.trace(ClusterConnectionImpl.this + " Consumer created " + message);
if (logger.isTraceEnabled()) {
logger.trace(ClusterConnectionImpl.this + " Consumer created " + message);
}
if (!message.containsProperty(ManagementHelper.HDR_DISTANCE)) {
throw new IllegalStateException("distance is null");
@ -1320,8 +1321,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
}
private synchronized void doConsumerClosed(final ClientMessage message) throws Exception {
if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
ActiveMQServerLogger.LOGGER.trace(ClusterConnectionImpl.this + " Consumer closed " + message);
if (logger.isTraceEnabled()) {
logger.trace(ClusterConnectionImpl.this + " Consumer closed " + message);
}
if (!message.containsProperty(ManagementHelper.HDR_DISTANCE)) {
throw new IllegalStateException("distance is null");
@ -1424,8 +1425,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
@Override
public ServerLocatorInternal createServerLocator() {
if (tcConfigs != null && tcConfigs.length > 0) {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug(ClusterConnectionImpl.this + "Creating a serverLocator for " + Arrays.toString(tcConfigs));
if (logger.isDebugEnabled()) {
logger.debug(ClusterConnectionImpl.this + "Creating a serverLocator for " + Arrays.toString(tcConfigs));
}
ServerLocatorImpl locator = new ServerLocatorImpl(topology, true, tcConfigs);
locator.setClusterConnection(true);
@ -1462,7 +1463,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
@Override
public void removeRecord(String targetNodeID) {
ActiveMQServerLogger.LOGGER.debug("Removing record for: " + targetNodeID);
logger.debug("Removing record for: " + targetNodeID);
MessageFlowRecord record = records.remove(targetNodeID);
try {
if (record != null) {
@ -1476,7 +1477,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
@Override
public void disconnectRecord(String targetNodeID) {
ActiveMQServerLogger.LOGGER.debug("Disconnecting record for: " + targetNodeID);
logger.debug("Disconnecting record for: " + targetNodeID);
MessageFlowRecord record = records.get(targetNodeID);
try {
if (record != null) {

View File

@ -29,14 +29,16 @@ import org.apache.activemq.artemis.core.filter.impl.FilterImpl;
import org.apache.activemq.artemis.core.message.impl.MessageImpl;
import org.apache.activemq.artemis.core.postoffice.BindingType;
import org.apache.activemq.artemis.core.server.Bindable;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.RoutingContext;
import org.apache.activemq.artemis.core.server.ServerMessage;
import org.apache.activemq.artemis.core.server.cluster.RemoteQueueBinding;
import org.jboss.logging.Logger;
public class RemoteQueueBindingImpl implements RemoteQueueBinding {
private static final Logger logger = Logger.getLogger(RemoteQueueBindingImpl.class);
private final SimpleString address;
private final Queue storeAndForwardQueue;
@ -336,8 +338,8 @@ public class RemoteQueueBindingImpl implements RemoteQueueBinding {
message.putBytesProperty(idsHeaderName, ids);
if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
ActiveMQServerLogger.LOGGER.trace("Adding remoteQueue ID = " + remoteQueueID + " into message=" + message + " store-forward-queue=" + storeAndForwardQueue);
if (logger.isTraceEnabled()) {
logger.trace("Adding remoteQueue ID = " + remoteQueueID + " into message=" + message + " store-forward-queue=" + storeAndForwardQueue);
}
}

View File

@ -20,8 +20,8 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
@ -40,12 +40,15 @@ import org.apache.activemq.artemis.core.server.management.ManagementService;
import org.apache.activemq.artemis.core.server.management.Notification;
import org.apache.activemq.artemis.utils.ExecutorFactory;
import org.apache.activemq.artemis.utils.TypedProperties;
import org.jboss.logging.Logger;
/**
* A Local Grouping handler. All the Remote handlers will talk with us
*/
public final class LocalGroupingHandler extends GroupHandlingAbstract {
private static final Logger logger = Logger.getLogger(LocalGroupingHandler.class);
private final ConcurrentMap<SimpleString, GroupBinding> map = new ConcurrentHashMap<>();
private final ConcurrentMap<SimpleString, List<GroupBinding>> groupMap = new ConcurrentHashMap<>();
@ -189,7 +192,7 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract {
@Override
public Response receive(final Proposal proposal, final int distance) throws Exception {
ActiveMQServerLogger.LOGGER.trace("received proposal " + proposal);
logger.trace("received proposal " + proposal);
return propose(proposal);
}
@ -262,7 +265,7 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract {
expectedBindings.removeAll(bindingsAlreadyAdded);
if (expectedBindings.size() > 0) {
ActiveMQServerLogger.LOGGER.debug("Waiting remote group bindings to arrive before starting the server. timeout=" + timeout + " milliseconds");
logger.debug("Waiting remote group bindings to arrive before starting the server. timeout=" + timeout + " milliseconds");
//now we wait here for the rest to be received in onNotification, it will signal once all have been received.
//if we arent signaled then bindingsAdded still has some groupids we need to remove.
if (!awaitCondition.await(timeout, TimeUnit.MILLISECONDS)) {
@ -296,20 +299,20 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract {
if (expectedBindings != null) {
if (waitingForBindings) {
if (expectedBindings.remove(clusterName)) {
ActiveMQServerLogger.LOGGER.debug("OnNotification for waitForbindings::Removed clusterName=" + clusterName + " from lis succesffully");
logger.debug("OnNotification for waitForbindings::Removed clusterName=" + clusterName + " from lis succesffully");
}
else {
ActiveMQServerLogger.LOGGER.debug("OnNotification for waitForbindings::Couldn't remove clusterName=" + clusterName + " as it wasn't on the original list");
logger.debug("OnNotification for waitForbindings::Couldn't remove clusterName=" + clusterName + " as it wasn't on the original list");
}
}
else {
expectedBindings.add(clusterName);
ActiveMQServerLogger.LOGGER.debug("Notification for waitForbindings::Adding previously known item clusterName=" + clusterName);
logger.debug("Notification for waitForbindings::Adding previously known item clusterName=" + clusterName);
}
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
if (logger.isDebugEnabled()) {
for (SimpleString stillWaiting : expectedBindings) {
ActiveMQServerLogger.LOGGER.debug("Notification for waitForbindings::Still waiting for clusterName=" + stillWaiting);
logger.debug("Notification for waitForbindings::Still waiting for clusterName=" + stillWaiting);
}
}

View File

@ -144,12 +144,15 @@ import org.apache.activemq.artemis.utils.ReusableLatch;
import org.apache.activemq.artemis.utils.SecurityFormatter;
import org.apache.activemq.artemis.utils.TimeUtils;
import org.apache.activemq.artemis.utils.VersionLoader;
import org.jboss.logging.Logger;
/**
* The ActiveMQ Artemis server implementation
*/
public class ActiveMQServerImpl implements ActiveMQServer {
private static final Logger logger = Logger.getLogger(ActiveMQServerImpl.class);
/**
* JMS Topics (which are outside of the scope of the core API) will require a dumb subscription
* with a dummy-filter at this current version as a way to keep its existence valid and TCK
@ -378,7 +381,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
@Override
public final synchronized void start() throws Exception {
if (state != SERVER_STATE.STOPPED) {
ActiveMQServerLogger.LOGGER.debug("Server already started!");
logger.debug("Server already started!");
return;
}
@ -392,7 +395,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
activationLatch.setCount(1);
ActiveMQServerLogger.LOGGER.debug("Starting server " + this);
logger.debug("Starting server " + this);
OperationContextImpl.clearContext();
@ -780,7 +783,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
if (!threadPool.awaitTermination(10, TimeUnit.SECONDS)) {
ActiveMQServerLogger.LOGGER.timedOutStoppingThreadpool(threadPool);
for (Runnable r : threadPool.shutdownNow()) {
ActiveMQServerLogger.LOGGER.debug("Cancelled the execution of " + r);
logger.debug("Cancelled the execution of " + r);
}
}
}
@ -1373,8 +1376,8 @@ public class ActiveMQServerImpl implements ActiveMQServer {
throw ActiveMQMessageBundle.BUNDLE.queueSubscriptionBelongsToDifferentFilter(name);
}
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Transient Queue " + name + " created on address " + name +
if (logger.isDebugEnabled()) {
logger.debug("Transient Queue " + name + " created on address " + name +
" with filter=" + filterString);
}
@ -2066,7 +2069,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
}
}
catch (Throwable ignored) {
ActiveMQServerLogger.LOGGER.debug(ignored.getMessage(), ignored);
logger.debug(ignored.getMessage(), ignored);
}
throw e;
}

View File

@ -28,8 +28,8 @@ 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;
/**
* This implementation looks for any available live node, once tried with no success it is marked as
@ -37,6 +37,8 @@ import org.apache.activemq.artemis.core.server.LiveNodeLocator;
*/
public class AnyLiveNodeLocatorForScaleDown extends LiveNodeLocator {
private static final Logger logger = Logger.getLogger(AnyLiveNodeLocatorForScaleDown.class);
private final Lock lock = new ReentrantLock();
private final Condition condition = lock.newCondition();
private final ActiveMQServerImpl server;
@ -88,8 +90,8 @@ public class AnyLiveNodeLocatorForScaleDown 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;

View File

@ -22,9 +22,12 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.AutoCreatedQueueManager;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.utils.ReferenceCounterUtil;
import org.jboss.logging.Logger;
public class AutoCreatedQueueManagerImpl implements AutoCreatedQueueManager {
private static final Logger logger = Logger.getLogger(AutoCreatedQueueManagerImpl.class);
private final SimpleString queueName;
private final ActiveMQServer server;
@ -39,14 +42,14 @@ public class AutoCreatedQueueManagerImpl implements AutoCreatedQueueManager {
boolean isAutoDeleteJmsQueues = server.getAddressSettingsRepository().getMatch(queueName.toString()).isAutoDeleteJmsQueues();
if (server.locateQueue(queueName).getMessageCount() == 0 && isAutoDeleteJmsQueues) {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("deleting auto-created queue \"" + queueName + ".\" consumerCount = " + consumerCount + "; messageCount = " + messageCount + "; isAutoDeleteJmsQueues = " + isAutoDeleteJmsQueues);
if (logger.isDebugEnabled()) {
logger.debug("deleting auto-created queue \"" + queueName + ".\" consumerCount = " + consumerCount + "; messageCount = " + messageCount + "; isAutoDeleteJmsQueues = " + isAutoDeleteJmsQueues);
}
server.destroyQueue(queueName, null, false);
}
else if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("NOT deleting auto-created queue \"" + queueName + ".\" consumerCount = " + consumerCount + "; messageCount = " + messageCount + "; isAutoDeleteJmsQueues = " + isAutoDeleteJmsQueues);
else if (logger.isDebugEnabled()) {
logger.debug("NOT deleting auto-created queue \"" + queueName + ".\" consumerCount = " + consumerCount + "; messageCount = " + messageCount + "; isAutoDeleteJmsQueues = " + isAutoDeleteJmsQueues);
}
}
catch (Exception e) {

View File

@ -20,17 +20,19 @@ import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.filter.Filter;
import org.apache.activemq.artemis.core.persistence.StorageManager;
import org.apache.activemq.artemis.core.postoffice.PostOffice;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.Divert;
import org.apache.activemq.artemis.core.server.RoutingContext;
import org.apache.activemq.artemis.core.server.ServerMessage;
import org.apache.activemq.artemis.core.server.cluster.Transformer;
import org.jboss.logging.Logger;
/**
* A DivertImpl simply diverts a message to a different forwardAddress
*/
public class DivertImpl implements Divert {
private static final Logger logger = Logger.getLogger(DivertImpl.class);
private final PostOffice postOffice;
private final SimpleString forwardAddress;
@ -77,8 +79,8 @@ public class DivertImpl implements Divert {
// We must make a copy of the message, otherwise things like returning credits to the page won't work
// properly on ack, since the original address will be overwritten
if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
ActiveMQServerLogger.LOGGER.trace("Diverting message " + message + " into " + this);
if (logger.isTraceEnabled()) {
logger.trace("Diverting message " + message + " into " + this);
}
long id = storageManager.generateID();

View File

@ -27,9 +27,12 @@ import org.apache.activemq.artemis.core.server.ActivateCallback;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.NodeManager;
import org.apache.activemq.artemis.utils.UUID;
import org.jboss.logging.Logger;
public class FileLockNodeManager extends NodeManager {
private static final Logger logger = Logger.getLogger(FileLockNodeManager.class);
private static final int LIVE_LOCK_POS = 1;
private static final int BACKUP_LOCK_POS = 2;
@ -114,7 +117,7 @@ public class FileLockNodeManager extends NodeManager {
do {
byte state = getState();
while (state == FileLockNodeManager.NOT_STARTED || state == FIRST_TIME_START) {
ActiveMQServerLogger.LOGGER.debug("awaiting live node startup state='" + state + "'");
logger.debug("awaiting live node startup state='" + state + "'");
Thread.sleep(2000);
state = getState();
}
@ -127,16 +130,16 @@ public class FileLockNodeManager extends NodeManager {
state = getState();
if (state == FileLockNodeManager.PAUSED) {
liveLock.release();
ActiveMQServerLogger.LOGGER.debug("awaiting live node restarting");
logger.debug("awaiting live node restarting");
Thread.sleep(2000);
}
else if (state == FileLockNodeManager.FAILINGBACK) {
liveLock.release();
ActiveMQServerLogger.LOGGER.debug("awaiting live node failing back");
logger.debug("awaiting live node failing back");
Thread.sleep(2000);
}
else if (state == FileLockNodeManager.LIVE) {
ActiveMQServerLogger.LOGGER.debug("acquired live node lock state = " + (char) state);
logger.debug("acquired live node lock state = " + (char) state);
break;
}
} while (true);

View File

@ -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);

View File

@ -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();

View File

@ -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;

View File

@ -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();

View File

@ -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) {

View File

@ -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()) {

View File

@ -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();

View File

@ -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);
}

View File

@ -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();

View File

@ -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) {

View File

@ -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);
}

View File

@ -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));
}
}

View File

@ -33,9 +33,12 @@ import org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy;
import org.apache.activemq.artemis.core.server.group.GroupingHandler;
import org.apache.activemq.artemis.core.server.management.ManagementService;
import org.jboss.logging.Logger;
public final class SharedStoreBackupActivation extends Activation {
private static final Logger logger = Logger.getLogger(SharedStoreBackupActivation.class);
//this is how we act as a backup
private SharedStoreSlavePolicy sharedStoreSlavePolicy;
@ -215,7 +218,7 @@ public final class SharedStoreBackupActivation extends Activation {
@Override
public void run() {
try {
ActiveMQServerLogger.LOGGER.debug(activeMQServer + "::Stopping live node in favor of failback");
logger.debug(activeMQServer + "::Stopping live node in favor of failback");
NodeManager nodeManager = activeMQServer.getNodeManager();
activeMQServer.stop(true, false, true);
@ -230,7 +233,7 @@ public final class SharedStoreBackupActivation extends Activation {
return;
activeMQServer.setHAPolicy(sharedStoreSlavePolicy);
ActiveMQServerLogger.LOGGER.debug(activeMQServer + "::Starting backup node now after failback");
logger.debug(activeMQServer + "::Starting backup node now after failback");
activeMQServer.start();
}
}

View File

@ -19,9 +19,12 @@ package org.apache.activemq.artemis.core.server.impl;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.NodeManager;
import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreMasterPolicy;
import org.jboss.logging.Logger;
public final class SharedStoreLiveActivation extends LiveActivation {
private static final Logger logger = Logger.getLogger(SharedStoreLiveActivation.class);
//this is how we act when we initially start as live
private SharedStoreMasterPolicy sharedStoreMasterPolicy;
@ -39,8 +42,8 @@ public final class SharedStoreLiveActivation extends LiveActivation {
activeMQServer.checkJournalDirectory();
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("First part initialization on " + this);
if (logger.isDebugEnabled()) {
logger.debug("First part initialization on " + this);
}
if (!activeMQServer.initialisePart1(false))
@ -51,8 +54,8 @@ public final class SharedStoreLiveActivation extends LiveActivation {
* looks like we've failed over at some point need to inform that we are the backup
* so when the current live goes down they failover to us
*/
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("announcing backup to the former live" + this);
if (logger.isDebugEnabled()) {
logger.debug("announcing backup to the former live" + this);
}
activeMQServer.getBackupManager().start();
activeMQServer.getBackupManager().announceBackup();

View File

@ -22,9 +22,12 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.TransientQueueManager;
import org.apache.activemq.artemis.utils.ReferenceCounterUtil;
import org.jboss.logging.Logger;
public class TransientQueueManagerImpl implements TransientQueueManager {
private static final Logger logger = Logger.getLogger(TransientQueueManagerImpl.class);
private final SimpleString queueName;
private final ActiveMQServer server;
@ -33,8 +36,8 @@ public class TransientQueueManagerImpl implements TransientQueueManager {
@Override
public void run() {
try {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("deleting temporary queue " + queueName);
if (logger.isDebugEnabled()) {
logger.debug("deleting temporary queue " + queueName);
}
try {

View File

@ -49,12 +49,12 @@ import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.DivertConfiguration;
import org.apache.activemq.artemis.core.management.impl.AcceptorControlImpl;
import org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl;
import org.apache.activemq.artemis.core.management.impl.AddressControlImpl;
import org.apache.activemq.artemis.core.management.impl.BridgeControlImpl;
import org.apache.activemq.artemis.core.management.impl.BroadcastGroupControlImpl;
import org.apache.activemq.artemis.core.management.impl.ClusterConnectionControlImpl;
import org.apache.activemq.artemis.core.management.impl.DivertControlImpl;
import org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl;
import org.apache.activemq.artemis.core.management.impl.QueueControlImpl;
import org.apache.activemq.artemis.core.messagecounter.MessageCounter;
import org.apache.activemq.artemis.core.messagecounter.MessageCounterManager;
@ -65,10 +65,10 @@ import org.apache.activemq.artemis.core.postoffice.PostOffice;
import org.apache.activemq.artemis.core.remoting.server.RemotingService;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.security.SecurityStore;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.Divert;
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.Divert;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.QueueFactory;
import org.apache.activemq.artemis.core.server.ServerMessage;
@ -85,11 +85,12 @@ import org.apache.activemq.artemis.core.transaction.ResourceManager;
import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
import org.apache.activemq.artemis.utils.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.TypedProperties;
import org.jboss.logging.Logger;
public class ManagementServiceImpl implements ManagementService {
// Constants -----------------------------------------------------
private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled();
private static final Logger logger = Logger.getLogger(ManagementServiceImpl.class);
private final MBeanServer mbeanServer;
@ -217,8 +218,8 @@ public class ManagementServiceImpl implements ManagementService {
registerInRegistry(ResourceNames.CORE_ADDRESS + address, addressControl);
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("registered address " + objectName);
if (logger.isDebugEnabled()) {
logger.debug("registered address " + objectName);
}
}
@ -244,8 +245,8 @@ public class ManagementServiceImpl implements ManagementService {
registerInJMX(objectName, queueControl);
registerInRegistry(ResourceNames.CORE_QUEUE + queue.getName(), queueControl);
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("registered queue " + objectName);
if (logger.isDebugEnabled()) {
logger.debug("registered queue " + objectName);
}
}
@ -264,8 +265,8 @@ public class ManagementServiceImpl implements ManagementService {
registerInJMX(objectName, new StandardMBean(divertControl, DivertControl.class));
registerInRegistry(ResourceNames.CORE_DIVERT + config.getName(), divertControl);
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("registered divert " + objectName);
if (logger.isDebugEnabled()) {
logger.debug("registered divert " + objectName);
}
}
@ -369,8 +370,8 @@ public class ManagementServiceImpl implements ManagementService {
ServerMessage reply = new ServerMessageImpl(storageManager.generateID(), 512);
String resourceName = message.getStringProperty(ManagementHelper.HDR_RESOURCE_NAME);
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("handling management message for " + resourceName);
if (logger.isDebugEnabled()) {
logger.debug("handling management message for " + resourceName);
}
String operation = message.getStringProperty(ManagementHelper.HDR_OPERATION_NAME);
@ -601,8 +602,8 @@ public class ManagementServiceImpl implements ManagementService {
@Override
public void sendNotification(final Notification notification) throws Exception {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("Sending Notification = " + notification +
if (logger.isTraceEnabled()) {
logger.trace("Sending Notification = " + notification +
", notificationEnabled=" + notificationsEnabled +
" messagingServerControl=" + messagingServerControl);
}
@ -629,8 +630,8 @@ public class ManagementServiceImpl implements ManagementService {
// Note at backup initialisation we don't want to send notifications either
// https://jira.jboss.org/jira/browse/HORNETQ-317
if (messagingServer == null || !messagingServer.isActive()) {
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("ignoring message " + notification + " as the server is not initialized");
if (logger.isDebugEnabled()) {
logger.debug("ignoring message " + notification + " as the server is not initialized");
}
return;
}

View File

@ -34,12 +34,15 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
import org.apache.activemq.artemis.core.settings.HierarchicalRepositoryChangeListener;
import org.apache.activemq.artemis.core.settings.Mergeable;
import org.jboss.logging.Logger;
/**
* allows objects to be mapped against a regex pattern and held in order in a list
*/
public class HierarchicalObjectRepository<T> implements HierarchicalRepository<T> {
private static final Logger logger = Logger.getLogger(HierarchicalObjectRepository.class);
private boolean listenersEnabled = true;
/**
* The default Match to fall back to
@ -248,7 +251,7 @@ public class HierarchicalObjectRepository<T> implements HierarchicalRepository<T
try {
boolean isImmutable = immutables.contains(match);
if (isImmutable) {
ActiveMQServerLogger.LOGGER.debug("Cannot remove match " + match + " since it came from a main config");
logger.debug("Cannot remove match " + match + " since it came from a main config");
}
else {
/**

View File

@ -30,10 +30,11 @@ import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.impl.RefsOperation;
import org.apache.activemq.artemis.core.transaction.Transaction;
import org.apache.activemq.artemis.core.transaction.TransactionOperation;
import org.jboss.logging.Logger;
public class TransactionImpl implements Transaction {
private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled();
private static final Logger logger = Logger.getLogger(TransactionImpl.class);
private List<TransactionOperation> operations;
@ -174,19 +175,19 @@ public class TransactionImpl implements Transaction {
@Override
public void prepare() throws Exception {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("TransactionImpl::prepare::" + this);
if (logger.isTraceEnabled()) {
logger.trace("TransactionImpl::prepare::" + this);
}
storageManager.readLock();
try {
synchronized (timeoutLock) {
if (isEffective()) {
ActiveMQServerLogger.LOGGER.debug("TransactionImpl::prepare::" + this + " is being ignored");
logger.debug("TransactionImpl::prepare::" + this + " is being ignored");
return;
}
if (state == State.ROLLBACK_ONLY) {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("TransactionImpl::prepare::rollbackonly, rollingback " + this);
if (logger.isTraceEnabled()) {
logger.trace("TransactionImpl::prepare::rollbackonly, rollingback " + this);
}
internalRollback();
@ -241,13 +242,13 @@ public class TransactionImpl implements Transaction {
@Override
public void commit(final boolean onePhase) throws Exception {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("TransactionImpl::commit::" + this);
if (logger.isTraceEnabled()) {
logger.trace("TransactionImpl::commit::" + this);
}
synchronized (timeoutLock) {
if (state == State.COMMITTED) {
// I don't think this could happen, but just in case
ActiveMQServerLogger.LOGGER.debug("TransactionImpl::commit::" + this + " is being ignored");
logger.debug("TransactionImpl::commit::" + this + " is being ignored");
return;
}
if (state == State.ROLLBACK_ONLY) {
@ -318,14 +319,14 @@ public class TransactionImpl implements Transaction {
@Override
public void rollback() throws Exception {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("TransactionImpl::rollback::" + this);
if (logger.isTraceEnabled()) {
logger.trace("TransactionImpl::rollback::" + this);
}
synchronized (timeoutLock) {
if (state == State.ROLLEDBACK) {
// I don't think this could happen, but just in case
ActiveMQServerLogger.LOGGER.debug("TransactionImpl::rollback::" + this + " is being ignored");
logger.debug("TransactionImpl::rollback::" + this + " is being ignored");
return;
}
if (xid != null) {
@ -344,8 +345,8 @@ public class TransactionImpl implements Transaction {
}
private void internalRollback() throws Exception {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("TransactionImpl::internalRollback " + this);
if (logger.isTraceEnabled()) {
logger.trace("TransactionImpl::internalRollback " + this);
}
beforeRollback();
@ -419,17 +420,17 @@ public class TransactionImpl implements Transaction {
@Override
public void markAsRollbackOnly(final ActiveMQException exception) {
synchronized (timeoutLock) {
if (isTrace) {
ActiveMQServerLogger.LOGGER.trace("TransactionImpl::" + this + " marking rollbackOnly for " + exception.toString() + ", msg=" + exception.getMessage());
if (logger.isTraceEnabled()) {
logger.trace("TransactionImpl::" + this + " marking rollbackOnly for " + exception.toString() + ", msg=" + exception.getMessage());
}
if (isEffective()) {
ActiveMQServerLogger.LOGGER.debug("Trying to mark transaction " + this.id + " xid=" + this.xid + " as rollbackOnly but it was already effective (prepared, committed or rolledback!)");
logger.debug("Trying to mark transaction " + this.id + " xid=" + this.xid + " as rollbackOnly but it was already effective (prepared, committed or rolledback!)");
return;
}
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Marking Transaction " + this.id + " as rollback only");
if (logger.isDebugEnabled()) {
logger.debug("Marking Transaction " + this.id + " as rollback only");
}
state = State.ROLLBACK_ONLY;

View File

@ -29,11 +29,11 @@ import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnection;
import org.apache.activemq.artemis.core.security.CheckType;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.spi.core.security.jaas.JaasCallbackHandler;
import org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal;
import org.apache.activemq.artemis.utils.CertificateUtil;
import org.jboss.logging.Logger;
/**
* This implementation delegates to the JAAS security interfaces.
@ -43,7 +43,7 @@ import org.apache.activemq.artemis.utils.CertificateUtil;
*/
public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 {
private final boolean trace = ActiveMQServerLogger.LOGGER.isTraceEnabled();
private static final Logger logger = Logger.getLogger(ActiveMQJAASSecurityManager.class);
private String configurationName;
private SecurityConfiguration configuration;
@ -72,7 +72,7 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 {
return true;
}
catch (LoginException e) {
ActiveMQServerLogger.LOGGER.debug("Couldn't validate user", e);
logger.debug("Couldn't validate user", e);
return false;
}
}
@ -98,7 +98,7 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 {
localSubject = getAuthenticatedSubject(user, password, certificates);
}
catch (LoginException e) {
ActiveMQServerLogger.LOGGER.debug("Couldn't validate user", e);
logger.debug("Couldn't validate user", e);
return false;
}
@ -121,8 +121,8 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 {
}
}
if (trace) {
ActiveMQServerLogger.LOGGER.trace("user " + (authorized ? " is " : " is NOT ") + "authorized");
if (logger.isTraceEnabled()) {
logger.trace("user " + (authorized ? " is " : " is NOT ") + "authorized");
}
}

View File

@ -30,7 +30,7 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.jboss.logging.Logger;
/**
* A LoginModule that allows for authentication based on SSL certificates.
@ -39,6 +39,8 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
*/
public abstract class CertificateLoginModule extends PropertiesLoader implements LoginModule {
private static final Logger logger = Logger.getLogger(CertificateLoginModule.class);
private CallbackHandler callbackHandler;
private Subject subject;
@ -82,7 +84,7 @@ public abstract class CertificateLoginModule extends PropertiesLoader implements
}
if (debug) {
ActiveMQServerLogger.LOGGER.debug("Certificate for user: " + username);
logger.debug("Certificate for user: " + username);
}
return true;
}
@ -103,7 +105,7 @@ public abstract class CertificateLoginModule extends PropertiesLoader implements
clear();
if (debug) {
ActiveMQServerLogger.LOGGER.debug("commit");
logger.debug("commit");
}
return true;
}
@ -116,7 +118,7 @@ public abstract class CertificateLoginModule extends PropertiesLoader implements
clear();
if (debug) {
ActiveMQServerLogger.LOGGER.debug("abort");
logger.debug("abort");
}
return true;
}
@ -130,7 +132,7 @@ public abstract class CertificateLoginModule extends PropertiesLoader implements
principals.clear();
if (debug) {
ActiveMQServerLogger.LOGGER.debug("logout");
logger.debug("logout");
}
return true;
}

View File

@ -29,7 +29,7 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.jboss.logging.Logger;
/**
* Always login the user with a default 'guest' identity.
@ -40,6 +40,8 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
*/
public class GuestLoginModule implements LoginModule {
private static final Logger logger = Logger.getLogger(GuestLoginModule.class);
private static final String GUEST_USER = "org.apache.activemq.jaas.guest.user";
private static final String GUEST_ROLE = "org.apache.activemq.jaas.guest.role";
@ -68,7 +70,7 @@ public class GuestLoginModule implements LoginModule {
principals.add(new RolePrincipal(roleName));
if (debug) {
ActiveMQServerLogger.LOGGER.debug("Initialized debug=" + debug + " guestUser=" + userName + " guestGroup=" + roleName);
logger.debug("Initialized debug=" + debug + " guestUser=" + userName + " guestGroup=" + roleName);
}
}
@ -82,7 +84,7 @@ public class GuestLoginModule implements LoginModule {
callbackHandler.handle(new Callback[]{passwordCallback});
if (passwordCallback.getPassword() != null) {
if (debug) {
ActiveMQServerLogger.LOGGER.debug("Guest login failing (credentialsInvalidate=true) on presence of a password");
logger.debug("Guest login failing (credentialsInvalidate=true) on presence of a password");
}
loginSucceeded = false;
passwordCallback.clearPassword();
@ -94,7 +96,7 @@ public class GuestLoginModule implements LoginModule {
}
}
if (debug) {
ActiveMQServerLogger.LOGGER.debug("Guest login " + loginSucceeded);
logger.debug("Guest login " + loginSucceeded);
}
return loginSucceeded;
}
@ -106,7 +108,7 @@ public class GuestLoginModule implements LoginModule {
}
if (debug) {
ActiveMQServerLogger.LOGGER.debug("commit: " + loginSucceeded);
logger.debug("commit: " + loginSucceeded);
}
return loginSucceeded;
}
@ -115,7 +117,7 @@ public class GuestLoginModule implements LoginModule {
public boolean abort() throws LoginException {
if (debug) {
ActiveMQServerLogger.LOGGER.debug("abort");
logger.debug("abort");
}
return true;
}
@ -125,7 +127,7 @@ public class GuestLoginModule implements LoginModule {
subject.getPrincipals().removeAll(principals);
if (debug) {
ActiveMQServerLogger.LOGGER.debug("logout");
logger.debug("logout");
}
return true;
}

View File

@ -33,9 +33,12 @@ import java.util.Map;
import java.util.Set;
import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.jboss.logging.Logger;
public class InVMLoginModule implements LoginModule {
private static final Logger logger = Logger.getLogger(InVMLoginModule.class);
public static final String CONFIG_PROP_NAME = "org.apache.activemq.jaas.invm.config";
private SecurityConfiguration configuration;
@ -92,7 +95,7 @@ public class InVMLoginModule implements LoginModule {
}
loginSucceeded = true;
ActiveMQServerLogger.LOGGER.debug("login " + user);
logger.debug("login " + user);
return loginSucceeded;
}
@ -117,7 +120,7 @@ public class InVMLoginModule implements LoginModule {
// will whack loginSucceeded
clear();
ActiveMQServerLogger.LOGGER.debug("commit, result: " + result);
logger.debug("commit, result: " + result);
return result;
}
@ -126,7 +129,7 @@ public class InVMLoginModule implements LoginModule {
public boolean abort() throws LoginException {
clear();
ActiveMQServerLogger.LOGGER.debug("abort");
logger.debug("abort");
return true;
}
@ -142,7 +145,7 @@ public class InVMLoginModule implements LoginModule {
principals.clear();
clear();
ActiveMQServerLogger.LOGGER.debug("logout");
logger.debug("logout");
return true;
}

View File

@ -53,9 +53,12 @@ import java.util.Queue;
import java.util.Set;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.jboss.logging.Logger;
public class LDAPLoginModule implements LoginModule {
private static final Logger logger = Logger.getLogger(LDAPLoginModule.class);
private static final String INITIAL_CONTEXT_FACTORY = "initialContextFactory";
private static final String CONNECTION_URL = "connectionURL";
private static final String CONNECTION_USERNAME = "connectionUsername";
@ -161,8 +164,8 @@ public class LDAPLoginModule implements LoginModule {
DirContext context = null;
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Create the LDAP initial context.");
if (logger.isDebugEnabled()) {
logger.debug("Create the LDAP initial context.");
}
try {
context = open();
@ -199,11 +202,11 @@ public class LDAPLoginModule implements LoginModule {
list.toArray(attribs);
constraints.setReturningAttributes(attribs);
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Get the user DN.");
ActiveMQServerLogger.LOGGER.debug("Looking for the user in LDAP with ");
ActiveMQServerLogger.LOGGER.debug(" base DN: " + getLDAPPropertyValue(USER_BASE));
ActiveMQServerLogger.LOGGER.debug(" filter: " + filter);
if (logger.isDebugEnabled()) {
logger.debug("Get the user DN.");
logger.debug("Looking for the user in LDAP with ");
logger.debug(" base DN: " + getLDAPPropertyValue(USER_BASE));
logger.debug(" filter: " + filter);
}
NamingEnumeration<SearchResult> results = context.search(getLDAPPropertyValue(USER_BASE), filter, constraints);
@ -221,7 +224,7 @@ public class LDAPLoginModule implements LoginModule {
String dn;
if (result.isRelative()) {
ActiveMQServerLogger.LOGGER.debug("LDAP returned a relative name: " + result.getName());
logger.debug("LDAP returned a relative name: " + result.getName());
NameParser parser = context.getNameParser("");
Name contextName = parser.parse(context.getNameInNamespace());
@ -232,7 +235,7 @@ public class LDAPLoginModule implements LoginModule {
dn = name.toString();
}
else {
ActiveMQServerLogger.LOGGER.debug("LDAP returned an absolute name: " + result.getName());
logger.debug("LDAP returned an absolute name: " + result.getName());
try {
URI uri = new URI(result.getName());
@ -253,8 +256,8 @@ public class LDAPLoginModule implements LoginModule {
}
}
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Using DN [" + dn + "] for binding.");
if (logger.isDebugEnabled()) {
logger.debug("Using DN [" + dn + "] for binding.");
}
Attributes attrs = result.getAttributes();
@ -270,8 +273,8 @@ public class LDAPLoginModule implements LoginModule {
if (bindUser(context, dn, password)) {
// if authenticated add more roles
roles = getRoles(context, dn, username, roles);
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Roles " + roles + " for user " + username);
if (logger.isDebugEnabled()) {
logger.debug("Roles " + roles + " for user " + username);
}
for (int i = 0; i < roles.size(); i++) {
groups.add(new RolePrincipal(roles.get(i)));
@ -323,11 +326,11 @@ public class LDAPLoginModule implements LoginModule {
else {
constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
}
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Get user roles.");
ActiveMQServerLogger.LOGGER.debug("Looking for the user roles in LDAP with ");
ActiveMQServerLogger.LOGGER.debug(" base DN: " + getLDAPPropertyValue(ROLE_BASE));
ActiveMQServerLogger.LOGGER.debug(" filter: " + filter);
if (logger.isDebugEnabled()) {
logger.debug("Get user roles.");
logger.debug("Looking for the user roles in LDAP with ");
logger.debug(" base DN: " + getLDAPPropertyValue(ROLE_BASE));
logger.debug(" filter: " + filter);
}
HashSet<String> haveSeenNames = new HashSet<>();
Queue<String> pendingNameExpansion = new LinkedList<>();
@ -396,22 +399,22 @@ public class LDAPLoginModule implements LoginModule {
protected boolean bindUser(DirContext context, String dn, String password) throws NamingException {
boolean isValid = false;
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Binding the user.");
if (logger.isDebugEnabled()) {
logger.debug("Binding the user.");
}
context.addToEnvironment(Context.SECURITY_PRINCIPAL, dn);
context.addToEnvironment(Context.SECURITY_CREDENTIALS, password);
try {
context.getAttributes("", null);
isValid = true;
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("User " + dn + " successfully bound.");
if (logger.isDebugEnabled()) {
logger.debug("User " + dn + " successfully bound.");
}
}
catch (AuthenticationException e) {
isValid = false;
if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
ActiveMQServerLogger.LOGGER.debug("Authentication failed for dn=" + dn);
if (logger.isDebugEnabled()) {
logger.debug("Authentication failed for dn=" + dn);
}
}

View File

@ -20,17 +20,19 @@ import java.io.File;
import java.util.HashMap;
import java.util.Map;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.jboss.logging.Logger;
public class PropertiesLoader {
private static final Logger logger = Logger.getLogger(PropertiesLoader.class);
static Map<FileNameKey, ReloadableProperties> staticCache = new HashMap<>();
protected boolean debug;
public void init(Map options) {
debug = booleanOption("debug", options);
if (debug) {
ActiveMQServerLogger.LOGGER.debug("Initialized debug");
logger.debug("Initialized debug");
}
}
@ -111,7 +113,7 @@ public class PropertiesLoader {
}
}
if (debug) {
ActiveMQServerLogger.LOGGER.debug("Using basedir=" + baseDir.getAbsolutePath());
logger.debug("Using basedir=" + baseDir.getAbsolutePath());
}
return baseDir;
}

View File

@ -32,10 +32,12 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.jboss.logging.Logger;
public class PropertiesLoginModule extends PropertiesLoader implements LoginModule {
private static final Logger logger = Logger.getLogger(PropertiesLoginModule.class);
private static final String USER_FILE_PROP_NAME = "org.apache.activemq.jaas.properties.user";
private static final String ROLE_FILE_PROP_NAME = "org.apache.activemq.jaas.properties.role";
@ -96,7 +98,7 @@ public class PropertiesLoginModule extends PropertiesLoader implements LoginModu
loginSucceeded = true;
if (debug) {
ActiveMQServerLogger.LOGGER.debug("login " + user);
logger.debug("login " + user);
}
return loginSucceeded;
}
@ -121,7 +123,7 @@ public class PropertiesLoginModule extends PropertiesLoader implements LoginModu
clear();
if (debug) {
ActiveMQServerLogger.LOGGER.debug("commit, result: " + result);
logger.debug("commit, result: " + result);
}
return result;
}
@ -131,7 +133,7 @@ public class PropertiesLoginModule extends PropertiesLoader implements LoginModu
clear();
if (debug) {
ActiveMQServerLogger.LOGGER.debug("abort");
logger.debug("abort");
}
return true;
}
@ -142,7 +144,7 @@ public class PropertiesLoginModule extends PropertiesLoader implements LoginModu
principals.clear();
clear();
if (debug) {
ActiveMQServerLogger.LOGGER.debug("logout");
logger.debug("logout");
}
return true;
}

View File

@ -26,9 +26,12 @@ import java.util.Properties;
import java.util.Set;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.jboss.logging.Logger;
public class ReloadableProperties {
private static final Logger logger = Logger.getLogger(ReloadableProperties.class);
private Properties props = new Properties();
private Map<String, String> invertedProps;
private Map<String, Set<String>> invertedValueProps;
@ -51,13 +54,13 @@ public class ReloadableProperties {
invertedProps = null;
invertedValueProps = null;
if (key.isDebug()) {
ActiveMQServerLogger.LOGGER.debug("Load of: " + key);
logger.debug("Load of: " + key);
}
}
catch (IOException e) {
ActiveMQServerLogger.LOGGER.error("Failed to load: " + key + ", reason:" + e.getLocalizedMessage());
if (key.isDebug()) {
ActiveMQServerLogger.LOGGER.debug("Load of: " + key + ", failure exception" + e);
logger.debug("Load of: " + key + ", failure exception" + e);
}
}
reloadTime = System.currentTimeMillis();

View File

@ -130,6 +130,7 @@ import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
import org.apache.activemq.artemis.utils.OrderedExecutorFactory;
import org.apache.activemq.artemis.utils.RandomUtil;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.jboss.logging.Logger;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@ -145,6 +146,8 @@ import org.junit.runner.Description;
*/
public abstract class ActiveMQTestBase extends Assert {
private static final Logger logger = Logger.getLogger(ActiveMQTestBase.class);
@Rule
public ThreadLeakCheckRule leakCheckRule = new ThreadLeakCheckRule();
@ -1096,7 +1099,7 @@ public abstract class ActiveMQTestBase extends Assert {
final int liveNodes,
final int backupNodes,
final long timeout) throws Exception {
ActiveMQServerLogger.LOGGER.debug("waiting for " + liveNodes + " on the topology for server = " + server);
logger.debug("waiting for " + liveNodes + " on the topology for server = " + server);
long start = System.currentTimeMillis();
@ -1147,7 +1150,7 @@ public abstract class ActiveMQTestBase extends Assert {
String clusterConnectionName,
final int nodes,
final long timeout) throws Exception {
ActiveMQServerLogger.LOGGER.debug("waiting for " + nodes + " on the topology for server = " + server);
logger.debug("waiting for " + nodes + " on the topology for server = " + server);
long start = System.currentTimeMillis();