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

View File

@ -165,7 +165,7 @@ public final class ActiveMQClient {
try { try {
if (!globalThreadPool.awaitTermination(time, unit)) { if (!globalThreadPool.awaitTermination(time, unit)) {
globalThreadPool.shutdownNow(); 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) { } catch (InterruptedException e) {
throw new ActiveMQInterruptedException(e); throw new ActiveMQInterruptedException(e);
@ -179,7 +179,7 @@ public final class ActiveMQClient {
try { try {
if (!globalScheduledThreadPool.awaitTermination(time, unit)) { if (!globalScheduledThreadPool.awaitTermination(time, unit)) {
globalScheduledThreadPool.shutdownNow(); 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) { } catch (InterruptedException e) {
throw new ActiveMQInterruptedException(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.jboss.logging.annotations.MessageLogger;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import java.net.UnknownHostException;
/** /**
* Logger Code 21 * Logger Code 21
* <p> * <p>
@ -320,6 +322,76 @@ public interface ActiveMQClientLogger extends BasicLogger {
format = Message.Format.MESSAGE_FORMAT) format = Message.Format.MESSAGE_FORMAT)
void unableToGetMessage(@Cause Exception e); 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) @LogMessage(level = Logger.Level.ERROR)
@Message(id = 214000, value = "Failed to call onMessage", format = Message.Format.MESSAGE_FORMAT) @Message(id = 214000, value = "Failed to call onMessage", format = Message.Format.MESSAGE_FORMAT)
void onMessageError(@Cause Throwable e); void onMessageError(@Cause Throwable e);
@ -454,4 +526,14 @@ public interface ActiveMQClientLogger extends BasicLogger {
@LogMessage(level = Logger.Level.ERROR) @LogMessage(level = Logger.Level.ERROR)
@Message(id = 214031, value = "Failed to decode buffer, disconnect immediately.", format = Message.Format.MESSAGE_FORMAT) @Message(id = 214031, value = "Failed to decode buffer, disconnect immediately.", format = Message.Format.MESSAGE_FORMAT)
void disconnectOnErrorDecoding(@Cause Throwable cause); 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 { try {
doCleanUp(false); doCleanUp(false);
} catch (ActiveMQException e) { } 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) { } catch (Exception e) {
ActiveMQClientLogger.LOGGER.warn(e.getMessage(), e); ActiveMQClientLogger.LOGGER.failedPerformPostActionsOnMessage(e);
} }
onMessageThread = null; onMessageThread = null;

View File

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

View File

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

View File

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

View File

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

View File

@ -194,7 +194,7 @@ public class NettyConnection implements Connection {
final ReadyListener readyListener = readyToCall.get(i); final ReadyListener readyListener = readyToCall.get(i);
readyListener.readyForWriting(); readyListener.readyForWriting();
} catch (Throwable logOnly) { } catch (Throwable logOnly) {
ActiveMQClientLogger.LOGGER.warn(logOnly.getMessage(), logOnly); ActiveMQClientLogger.LOGGER.failedToSetChannelReadyForWriting(logOnly);
} }
} }
} finally { } finally {
@ -208,7 +208,7 @@ public class NettyConnection implements Connection {
try { try {
channel.close(); channel.close();
} catch (Throwable e) { } 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); result = ip1.equals(ip2);
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
ActiveMQClientLogger.LOGGER.error("Cannot resolve host", e); ActiveMQClientLogger.LOGGER.unableToResolveHost(e);
} }
return result; return result;

View File

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