ARTEMIS-297 Including acceptor name on logs
This commit is contained in:
parent
d585d465b4
commit
9a2bebe443
|
@ -66,11 +66,17 @@ public final class InVMAcceptor implements Acceptor {
|
|||
|
||||
private final long connectionsAllowed;
|
||||
|
||||
public InVMAcceptor(final ClusterConnection clusterConnection,
|
||||
private final String name;
|
||||
|
||||
public InVMAcceptor(final String name,
|
||||
final ClusterConnection clusterConnection,
|
||||
final Map<String, Object> configuration,
|
||||
final BufferHandler handler,
|
||||
final ConnectionLifeCycleListener listener,
|
||||
final Executor threadPool) {
|
||||
|
||||
this.name = name;
|
||||
|
||||
this.clusterConnection = clusterConnection;
|
||||
|
||||
this.configuration = configuration;
|
||||
|
@ -86,6 +92,10 @@ public final class InVMAcceptor implements Acceptor {
|
|||
connectionsAllowed = ConfigurationHelper.getLongProperty(TransportConstants.CONNECTIONS_ALLOWED, TransportConstants.DEFAULT_CONNECTIONS_ALLOWED, configuration);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Map<String, Object> getConfiguration() {
|
||||
return configuration;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,6 @@ public class InVMAcceptorFactory implements AcceptorFactory {
|
|||
final Executor threadPool,
|
||||
final ScheduledExecutorService scheduledThreadPool,
|
||||
final Map<String, ProtocolManager> protocolHandler) {
|
||||
return new InVMAcceptor(clusterConnection, configuration, handler, listener, threadPool);
|
||||
return new InVMAcceptor(name, clusterConnection, configuration, handler, listener, threadPool);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -411,6 +411,10 @@ public class NettyAcceptor implements Acceptor {
|
|||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfers the Netty channel that has been created outside of this NettyAcceptor
|
||||
* to control it and configure it according to this NettyAcceptor setting.
|
||||
|
|
|
@ -304,7 +304,7 @@ public class RemotingServiceImpl implements RemotingService, ConnectionLifeCycle
|
|||
acceptor.pause();
|
||||
}
|
||||
catch (Exception e) {
|
||||
ActiveMQServerLogger.LOGGER.errorStoppingAcceptor();
|
||||
ActiveMQServerLogger.LOGGER.errorStoppingAcceptor(acceptor.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ public class RemotingServiceImpl implements RemotingService, ConnectionLifeCycle
|
|||
acceptor.pause();
|
||||
}
|
||||
catch (Throwable t) {
|
||||
ActiveMQServerLogger.LOGGER.errorStoppingAcceptor();
|
||||
ActiveMQServerLogger.LOGGER.errorStoppingAcceptor(acceptor.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ public class RemotingServiceImpl implements RemotingService, ConnectionLifeCycle
|
|||
acceptor.stop();
|
||||
}
|
||||
catch (Throwable t) {
|
||||
ActiveMQServerLogger.LOGGER.errorStoppingAcceptor();
|
||||
ActiveMQServerLogger.LOGGER.errorStoppingAcceptor(acceptor.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1292,8 +1292,8 @@ public interface ActiveMQServerLogger extends BasicLogger {
|
|||
void errorWritingToInvmConnector(@Cause Exception e, Runnable runnable);
|
||||
|
||||
@LogMessage(level = Logger.Level.ERROR)
|
||||
@Message(id = 224028, value = "Failed to stop acceptor", format = Message.Format.MESSAGE_FORMAT)
|
||||
void errorStoppingAcceptor();
|
||||
@Message(id = 224028, value = "Failed to stop accepto {0}r", format = Message.Format.MESSAGE_FORMAT)
|
||||
void errorStoppingAcceptor(String name);
|
||||
|
||||
@LogMessage(level = Logger.Level.ERROR)
|
||||
@Message(id = 224029, value = "large message sync: largeMessage instance is incompatible with it, ignoring data", format = Message.Format.MESSAGE_FORMAT)
|
||||
|
|
|
@ -29,6 +29,10 @@ import org.apache.activemq.artemis.core.server.management.NotificationService;
|
|||
*/
|
||||
public interface Acceptor extends ActiveMQComponent {
|
||||
|
||||
/** The name of the acceptor used on the configuration.
|
||||
* for logging and debug purposes. */
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Pause the acceptor and stop it from receiving client requests.
|
||||
*/
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Set;
|
|||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||
import org.apache.activemq.artemis.tests.unit.core.remoting.server.impl.fake.FakeAcceptorFactory;
|
||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class AcceptorsTest extends ActiveMQTestBase {
|
|||
@Test
|
||||
public void testMultipleAcceptorsWithSameHostPortDifferentName() throws Exception
|
||||
{
|
||||
final String acceptorFactoryClass = "org.apache.activemq.artemis.tests.unit.core.remoting.server.impl.fake.FakeAcceptorFactory";
|
||||
final String acceptorFactoryClass = FakeAcceptorFactory.class.getName();
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("host", "localhost");
|
||||
|
|
|
@ -47,6 +47,10 @@ public class FakeAcceptorFactory implements AcceptorFactory {
|
|||
|
||||
private final class FakeAcceptor implements Acceptor {
|
||||
|
||||
public String getName() {
|
||||
return "fake";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue