ARTEMIS-1585 - Log connector details on start

Log connector details when they start. 
This is similar to that of acceptors, and helps when any issues later.
This commit is contained in:
Michael André Pearce 2018-01-05 17:53:34 +00:00 committed by Justin Bertram
parent eeb3f22433
commit 9c18dd04df
3 changed files with 22 additions and 5 deletions

View File

@ -64,6 +64,14 @@ public interface ActiveMQClientLogger extends BasicLogger {
@Message(id = 211001, value = "session created", format = Message.Format.MESSAGE_FORMAT) @Message(id = 211001, value = "session created", format = Message.Format.MESSAGE_FORMAT)
void dumpingSessionStack(@Cause Exception e); void dumpingSessionStack(@Cause Exception e);
@LogMessage(level = Logger.Level.INFO)
@Message(id = 211002, value = "Started {0} Netty Connector version {1} to {2}:{3,number,#}", format = Message.Format.MESSAGE_FORMAT)
void startedNettyConnector(String connectorType, String version, String host, Integer port);
@LogMessage(level = Logger.Level.INFO)
@Message(id = 211003, value = "Started InVM Connector", format = Message.Format.MESSAGE_FORMAT)
void startedInVMConnector();
@LogMessage(level = Logger.Level.WARN) @LogMessage(level = Logger.Level.WARN)
@Message(id = 212000, value = "{0}", format = Message.Format.MESSAGE_FORMAT) @Message(id = 212000, value = "{0}", format = Message.Format.MESSAGE_FORMAT)
void warn(String message); void warn(String message);

View File

@ -119,6 +119,10 @@ import static org.apache.activemq.artemis.utils.Base64.encodeBytes;
public class NettyConnector extends AbstractConnector { public class NettyConnector extends AbstractConnector {
public static String NIO_CONNECTOR_TYPE = "NIO";
public static String EPOLL_CONNECTOR_TYPE = "EPOLL";
public static String KQUEUE_CONNECTOR_TYPE = "KQUEUE";
private static final Logger logger = Logger.getLogger(NettyConnector.class); private static final Logger logger = Logger.getLogger(NettyConnector.class);
// Constants ----------------------------------------------------- // Constants -----------------------------------------------------
@ -423,13 +427,15 @@ public class NettyConnector extends AbstractConnector {
remotingThreads = Runtime.getRuntime().availableProcessors() * 3; remotingThreads = Runtime.getRuntime().availableProcessors() * 3;
} }
String connectorType;
if (useEpoll && Epoll.isAvailable()) { if (useEpoll && Epoll.isAvailable()) {
if (useGlobalWorkerPool) { if (useGlobalWorkerPool) {
group = SharedEventLoopGroup.getInstance((threadFactory -> new EpollEventLoopGroup(remotingThreads, threadFactory))); group = SharedEventLoopGroup.getInstance((threadFactory -> new EpollEventLoopGroup(remotingThreads, threadFactory)));
} else { } else {
group = new EpollEventLoopGroup(remotingThreads); group = new EpollEventLoopGroup(remotingThreads);
} }
connectorType = EPOLL_CONNECTOR_TYPE;
channelClazz = EpollSocketChannel.class; channelClazz = EpollSocketChannel.class;
logger.debug("Connector " + this + " using native epoll"); logger.debug("Connector " + this + " using native epoll");
} else if (useKQueue && KQueue.isAvailable()) { } else if (useKQueue && KQueue.isAvailable()) {
@ -438,7 +444,7 @@ public class NettyConnector extends AbstractConnector {
} else { } else {
group = new KQueueEventLoopGroup(remotingThreads); group = new KQueueEventLoopGroup(remotingThreads);
} }
connectorType = KQUEUE_CONNECTOR_TYPE;
channelClazz = KQueueSocketChannel.class; channelClazz = KQueueSocketChannel.class;
logger.debug("Connector " + this + " using native kqueue"); logger.debug("Connector " + this + " using native kqueue");
} else { } else {
@ -449,7 +455,7 @@ public class NettyConnector extends AbstractConnector {
channelClazz = NioSocketChannel.class; channelClazz = NioSocketChannel.class;
group = new NioEventLoopGroup(remotingThreads); group = new NioEventLoopGroup(remotingThreads);
} }
connectorType = NIO_CONNECTOR_TYPE;
channelClazz = NioSocketChannel.class; channelClazz = NioSocketChannel.class;
logger.debug("Connector + " + this + " using nio"); logger.debug("Connector + " + this + " using nio");
} }
@ -634,8 +640,7 @@ public class NettyConnector extends AbstractConnector {
batchFlusherFuture = scheduledThreadPool.scheduleWithFixedDelay(flusher, batchDelay, batchDelay, TimeUnit.MILLISECONDS); batchFlusherFuture = scheduledThreadPool.scheduleWithFixedDelay(flusher, batchDelay, batchDelay, TimeUnit.MILLISECONDS);
} }
ActiveMQClientLogger.LOGGER.startedNettyConnector(connectorType, TransportConstants.NETTY_VERSION, host, port);
logger.debug("Started Netty Connector version " + TransportConstants.NETTY_VERSION);
} }
@Override @Override

View File

@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
import org.apache.activemq.artemis.core.server.ActiveMQComponent; import org.apache.activemq.artemis.core.server.ActiveMQComponent;
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
import org.apache.activemq.artemis.spi.core.remoting.AbstractConnector; import org.apache.activemq.artemis.spi.core.remoting.AbstractConnector;
@ -47,6 +48,8 @@ import org.jboss.logging.Logger;
public class InVMConnector extends AbstractConnector { public class InVMConnector extends AbstractConnector {
public static String INVM_CONNECTOR_TYPE = "IN-VM";
private static final Logger logger = Logger.getLogger(InVMConnector.class); private static final Logger logger = Logger.getLogger(InVMConnector.class);
public static final Map<String, Object> DEFAULT_CONFIG; public static final Map<String, Object> DEFAULT_CONFIG;
@ -195,6 +198,7 @@ public class InVMConnector extends AbstractConnector {
@Override @Override
public synchronized void start() { public synchronized void start() {
started = true; started = true;
ActiveMQClientLogger.LOGGER.startedInVMConnector();
} }
public BufferHandler getHandler() { public BufferHandler getHandler() {