This commit is contained in:
Clebert Suconic 2017-07-31 12:51:16 -04:00
commit 7973410355
11 changed files with 100 additions and 21 deletions

View File

@ -155,7 +155,7 @@ public final class UDPBroadcastEndpointFactory implements BroadcastEndpointFacto
continue;
} catch (IOException e) {
if (open) {
ActiveMQClientLogger.LOGGER.warn(this + " getting exception when receiving broadcasting.", e);
ActiveMQClientLogger.LOGGER.unableToReceiveBroadcast(e, this.toString());
}
}
break;
@ -262,7 +262,7 @@ public final class UDPBroadcastEndpointFactory implements BroadcastEndpointFacto
}
return tmp;
} catch (Throwable t) {
ActiveMQClientLogger.LOGGER.warn(t);
ActiveMQClientLogger.LOGGER.unableToGetProperty(t);
return defaultValue;
}
}
@ -273,7 +273,7 @@ public final class UDPBroadcastEndpointFactory implements BroadcastEndpointFacto
try {
return Integer.parseInt(value);
} catch (Throwable t) {
ActiveMQClientLogger.LOGGER.warn(t.getMessage(), t);
ActiveMQClientLogger.LOGGER.unableToParseValue(t);
return Integer.parseInt(defaultValue);
}

View File

@ -165,7 +165,7 @@ public final class ActiveMQClient {
try {
if (!globalThreadPool.awaitTermination(time, unit)) {
globalThreadPool.shutdownNow();
ActiveMQClientLogger.LOGGER.warn("Couldn't finish the client globalThreadPool in less than 10 seconds, interrupting it now");
ActiveMQClientLogger.LOGGER.unableToProcessGlobalThreadPoolIn10Sec();
}
} catch (InterruptedException e) {
throw new ActiveMQInterruptedException(e);
@ -179,7 +179,7 @@ public final class ActiveMQClient {
try {
if (!globalScheduledThreadPool.awaitTermination(time, unit)) {
globalScheduledThreadPool.shutdownNow();
ActiveMQClientLogger.LOGGER.warn("Couldn't finish the client scheduled in less than 10 seconds, interrupting it now");
ActiveMQClientLogger.LOGGER.unableToProcessScheduledlIn10Sec();
}
} catch (InterruptedException e) {
throw new ActiveMQInterruptedException(e);

View File

@ -27,6 +27,8 @@ import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;
import org.w3c.dom.Node;
import java.net.UnknownHostException;
/**
* Logger Code 21
* <p>
@ -320,6 +322,76 @@ public interface ActiveMQClientLogger extends BasicLogger {
format = Message.Format.MESSAGE_FORMAT)
void unableToGetMessage(@Cause Exception e);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212059, value = "Failed to clean up: {0} ",
format = Message.Format.MESSAGE_FORMAT)
void failedCleaningUp(String target);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212060, value = "Unexpected null data received from DiscoveryEndpoint ",
format = Message.Format.MESSAGE_FORMAT)
void unexpectedNullDataReceived();
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212061, value = "Failed to perform force close ",
format = Message.Format.MESSAGE_FORMAT)
void failedForceClose(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212062, value = "Failed to perform post actions on message processing ",
format = Message.Format.MESSAGE_FORMAT)
void failedPerformPostActionsOnMessage(@Cause Exception e);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212063, value = "Unable to handle connection failure ",
format = Message.Format.MESSAGE_FORMAT)
void unableToHandleConnectionFailure(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212064, value = "Unable to receive cluster topology ",
format = Message.Format.MESSAGE_FORMAT)
void unableToReceiveClusterTopology(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212065, value = "{0} getting exception when receiving broadcasting ",
format = Message.Format.MESSAGE_FORMAT)
void unableToReceiveBroadcast(@Cause Exception e, String target);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212066, value = "failed to parse int property ",
format = Message.Format.MESSAGE_FORMAT)
void unableToParseValue(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212067, value = "failed to get system property ",
format = Message.Format.MESSAGE_FORMAT)
void unableToGetProperty(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212068, value = "Couldn't finish the client globalThreadPool in less than 10 seconds, interrupting it now ",
format = Message.Format.MESSAGE_FORMAT)
void unableToProcessGlobalThreadPoolIn10Sec();
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212069, value = "Couldn't finish the client scheduled in less than 10 seconds, interrupting it now ",
format = Message.Format.MESSAGE_FORMAT)
void unableToProcessScheduledlIn10Sec();
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212070, value = "Unable to initialize VersionLoader ",
format = Message.Format.MESSAGE_FORMAT)
void unableToInitVersionLoader(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212071, value = "Unable to check Epoll availability ",
format = Message.Format.MESSAGE_FORMAT)
void unableToCheckEpollAvailability(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212072, value = "Failed to change channel state to ReadyForWriting ",
format = Message.Format.MESSAGE_FORMAT)
void failedToSetChannelReadyForWriting(@Cause Throwable e);
@LogMessage(level = Logger.Level.ERROR)
@Message(id = 214000, value = "Failed to call onMessage", format = Message.Format.MESSAGE_FORMAT)
void onMessageError(@Cause Throwable e);
@ -454,4 +526,14 @@ public interface ActiveMQClientLogger extends BasicLogger {
@LogMessage(level = Logger.Level.ERROR)
@Message(id = 214031, value = "Failed to decode buffer, disconnect immediately.", format = Message.Format.MESSAGE_FORMAT)
void disconnectOnErrorDecoding(@Cause Throwable cause);
@LogMessage(level = Logger.Level.ERROR)
@Message(id = 214032, value = "Unable to initialize VersionLoader ",
format = Message.Format.MESSAGE_FORMAT)
void unableToInitVersionLoaderError(@Cause Throwable e);
@LogMessage(level = Logger.Level.ERROR)
@Message(id = 214033, value = "Cannot resolve host ",
format = Message.Format.MESSAGE_FORMAT)
void unableToResolveHost(@Cause UnknownHostException e);
}

View File

@ -470,7 +470,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
try {
doCleanUp(false);
} catch (ActiveMQException e) {
ActiveMQClientLogger.LOGGER.warn("problem cleaning up: " + this);
ActiveMQClientLogger.LOGGER.failedCleaningUp(this.toString());
}
}
@ -1005,7 +1005,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
}
});
} catch (Exception e) {
ActiveMQClientLogger.LOGGER.warn(e.getMessage(), e);
ActiveMQClientLogger.LOGGER.failedPerformPostActionsOnMessage(e);
}
onMessageThread = null;

View File

@ -474,7 +474,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
return latchFinalTopology.await(timeout, unit);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
ActiveMQClientLogger.LOGGER.warn(e.getMessage(), e);
ActiveMQClientLogger.LOGGER.unableToReceiveClusterTopology(e);
return false;
}
}
@ -506,7 +506,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
// this is just a debug, since an interrupt is an expected event (in case of a shutdown)
logger.debug(e1.getMessage(), e1);
} catch (Throwable t) {
logger.warn(t.getMessage(), t);
ActiveMQClientLogger.LOGGER.unableToHandleConnectionFailure(t);
//for anything else just close so clients are un blocked
close();
throw t;

View File

@ -255,9 +255,7 @@ public final class DiscoveryGroup implements ActiveMQComponent {
data = endpoint.receiveBroadcast();
if (data == null) {
if (started) {
// This is totally unexpected, so I'm not even bothering on creating
// a log entry for that
ActiveMQClientLogger.LOGGER.warn("Unexpected null data received from DiscoveryEndpoint");
ActiveMQClientLogger.LOGGER.unexpectedNullDataReceived();
}
break;
}

View File

@ -201,7 +201,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
try {
transportConnection.forceClose();
} catch (Throwable e) {
ActiveMQClientLogger.LOGGER.warn(e.getMessage(), e);
ActiveMQClientLogger.LOGGER.failedForceClose(e);
}
// Then call the listeners

View File

@ -17,15 +17,14 @@
package org.apache.activemq.artemis.core.remoting.impl.netty;
import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
import org.apache.activemq.artemis.utils.Env;
import org.jboss.logging.Logger;
/**
* Tells if <a href="http://netty.io/wiki/native-transports.html">{@code netty-transport-native-epoll}</a> is supported.
*/
public final class Epoll {
private static final Logger logger = Logger.getLogger(Epoll.class);
private static final boolean IS_AVAILABLE_EPOLL = isIsAvailableEpoll();
private static boolean isIsAvailableEpoll() {
@ -36,7 +35,7 @@ public final class Epoll {
return false;
}
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
ActiveMQClientLogger.LOGGER.unableToCheckEpollAvailability(e);
return false;
}

View File

@ -194,7 +194,7 @@ public class NettyConnection implements Connection {
final ReadyListener readyListener = readyToCall.get(i);
readyListener.readyForWriting();
} catch (Throwable logOnly) {
ActiveMQClientLogger.LOGGER.warn(logOnly.getMessage(), logOnly);
ActiveMQClientLogger.LOGGER.failedToSetChannelReadyForWriting(logOnly);
}
}
} finally {
@ -208,7 +208,7 @@ public class NettyConnection implements Connection {
try {
channel.close();
} catch (Throwable e) {
ActiveMQClientLogger.LOGGER.warn(e.getMessage(), e);
ActiveMQClientLogger.LOGGER.failedForceClose(e);
}
}
}

View File

@ -1111,7 +1111,7 @@ public class NettyConnector extends AbstractConnector {
result = ip1.equals(ip2);
} catch (UnknownHostException e) {
ActiveMQClientLogger.LOGGER.error("Cannot resolve host", e);
ActiveMQClientLogger.LOGGER.unableToResolveHost(e);
}
return result;

View File

@ -57,7 +57,7 @@ public final class VersionLoader {
}
});
} catch (Throwable e) {
ActiveMQClientLogger.LOGGER.warn(e.getMessage(), e);
ActiveMQClientLogger.LOGGER.unableToInitVersionLoader(e);
PROP_FILE_NAME = null;
}
@ -68,7 +68,7 @@ public final class VersionLoader {
VersionLoader.versions = VersionLoader.load();
} catch (Throwable e) {
VersionLoader.versions = null;
ActiveMQClientLogger.LOGGER.error(e.getMessage(), e);
ActiveMQClientLogger.LOGGER.unableToInitVersionLoaderError(e);
}
}