Search in sources :

Example 1 with ServerPacketDecoder

use of org.apache.activemq.artemis.core.protocol.ServerPacketDecoder in project activemq-artemis by apache.

the class CoreProtocolManager method createConnectionEntry.

@Override
public ConnectionEntry createConnectionEntry(final Acceptor acceptorUsed, final Connection connection) {
    final Configuration config = server.getConfiguration();
    Executor connectionExecutor = server.getExecutorFactory().getExecutor();
    final CoreRemotingConnection rc = new RemotingConnectionImpl(new ServerPacketDecoder(), connection, incomingInterceptors, outgoingInterceptors, config.isAsyncConnectionExecutionEnabled() ? connectionExecutor : null, server.getNodeID());
    Channel channel1 = rc.getChannel(CHANNEL_ID.SESSION.id, -1);
    ChannelHandler handler = new ActiveMQPacketHandler(this, server, channel1, rc);
    channel1.setHandler(handler);
    long ttl = ActiveMQClient.DEFAULT_CONNECTION_TTL;
    if (config.getConnectionTTLOverride() != -1) {
        ttl = config.getConnectionTTLOverride();
    }
    final ConnectionEntry entry = new ConnectionEntry(rc, connectionExecutor, System.currentTimeMillis(), ttl);
    final Channel channel0 = rc.getChannel(ChannelImpl.CHANNEL_ID.PING.id, -1);
    channel0.setHandler(new LocalChannelHandler(config, entry, channel0, acceptorUsed, rc));
    server.getClusterManager().addClusterChannelHandler(rc.getChannel(CHANNEL_ID.CLUSTER.id, -1), acceptorUsed, rc, server.getActivation());
    return entry;
}
Also used : Executor(java.util.concurrent.Executor) Configuration(org.apache.activemq.artemis.core.config.Configuration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ConnectionEntry(org.apache.activemq.artemis.spi.core.protocol.ConnectionEntry) CoreRemotingConnection(org.apache.activemq.artemis.core.protocol.core.CoreRemotingConnection) Channel(org.apache.activemq.artemis.core.protocol.core.Channel) ChannelHandler(org.apache.activemq.artemis.core.protocol.core.ChannelHandler) ServerPacketDecoder(org.apache.activemq.artemis.core.protocol.ServerPacketDecoder)

Aggregations

Executor (java.util.concurrent.Executor)1 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)1 Configuration (org.apache.activemq.artemis.core.config.Configuration)1 ServerPacketDecoder (org.apache.activemq.artemis.core.protocol.ServerPacketDecoder)1 Channel (org.apache.activemq.artemis.core.protocol.core.Channel)1 ChannelHandler (org.apache.activemq.artemis.core.protocol.core.ChannelHandler)1 CoreRemotingConnection (org.apache.activemq.artemis.core.protocol.core.CoreRemotingConnection)1 ConnectionEntry (org.apache.activemq.artemis.spi.core.protocol.ConnectionEntry)1