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)
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)
@Message(id = 212000, value = "{0}", format = Message.Format.MESSAGE_FORMAT)
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 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);
// Constants -----------------------------------------------------
@ -423,13 +427,15 @@ public class NettyConnector extends AbstractConnector {
remotingThreads = Runtime.getRuntime().availableProcessors() * 3;
}
String connectorType;
if (useEpoll && Epoll.isAvailable()) {
if (useGlobalWorkerPool) {
group = SharedEventLoopGroup.getInstance((threadFactory -> new EpollEventLoopGroup(remotingThreads, threadFactory)));
} else {
group = new EpollEventLoopGroup(remotingThreads);
}
connectorType = EPOLL_CONNECTOR_TYPE;
channelClazz = EpollSocketChannel.class;
logger.debug("Connector " + this + " using native epoll");
} else if (useKQueue && KQueue.isAvailable()) {
@ -438,7 +444,7 @@ public class NettyConnector extends AbstractConnector {
} else {
group = new KQueueEventLoopGroup(remotingThreads);
}
connectorType = KQUEUE_CONNECTOR_TYPE;
channelClazz = KQueueSocketChannel.class;
logger.debug("Connector " + this + " using native kqueue");
} else {
@ -449,7 +455,7 @@ public class NettyConnector extends AbstractConnector {
channelClazz = NioSocketChannel.class;
group = new NioEventLoopGroup(remotingThreads);
}
connectorType = NIO_CONNECTOR_TYPE;
channelClazz = NioSocketChannel.class;
logger.debug("Connector + " + this + " using nio");
}
@ -634,8 +640,7 @@ public class NettyConnector extends AbstractConnector {
batchFlusherFuture = scheduledThreadPool.scheduleWithFixedDelay(flusher, batchDelay, batchDelay, TimeUnit.MILLISECONDS);
}
logger.debug("Started Netty Connector version " + TransportConstants.NETTY_VERSION);
ActiveMQClientLogger.LOGGER.startedNettyConnector(connectorType, TransportConstants.NETTY_VERSION, host, port);
}
@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.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.ActiveMQMessageBundle;
import org.apache.activemq.artemis.spi.core.remoting.AbstractConnector;
@ -47,6 +48,8 @@ import org.jboss.logging.Logger;
public class InVMConnector extends AbstractConnector {
public static String INVM_CONNECTOR_TYPE = "IN-VM";
private static final Logger logger = Logger.getLogger(InVMConnector.class);
public static final Map<String, Object> DEFAULT_CONFIG;
@ -195,6 +198,7 @@ public class InVMConnector extends AbstractConnector {
@Override
public synchronized void start() {
started = true;
ActiveMQClientLogger.LOGGER.startedInVMConnector();
}
public BufferHandler getHandler() {