@Override public long getConnectionTTLOverride() { return configuration.getConnectionTTLOverride(); }
@Override public ConnectionEntry createConnectionEntry(final Acceptor acceptorUsed, final Connection connection) { StompConnection conn = new StompConnection(acceptorUsed, connection, this, server.getScheduledPool(), server.getExecutorFactory()); // Note that STOMP 1.0 has no heartbeat, so if connection ttl is non zero, data must continue to be sent or connection // will be timed out and closed! String ttlStr = (String) acceptorUsed.getConfiguration().get(TransportConstants.CONNECTION_TTL); Long ttl = ttlStr == null ? null : Long.valueOf(ttlStr); if (ttl != null) { if (ttl > 0) { return new ConnectionEntry(conn, null, System.currentTimeMillis(), ttl); } throw BUNDLE.negativeConnectionTTL(ttl); } ttl = server.getConfiguration().getConnectionTTLOverride(); if (ttl != -1) { return new ConnectionEntry(conn, null, System.currentTimeMillis(), ttl); } else { // Default to 1 minute - which is same as core protocol return new ConnectionEntry(conn, null, System.currentTimeMillis(), 1 * 60 * 1000); } }
@Override public ConnectionEntry createConnectionEntry(final Acceptor acceptorUsed, final Connection connection) { StompConnection conn = new StompConnection(acceptorUsed, connection, this, server.getScheduledPool(), server.getExecutorFactory()); // Note that STOMP 1.0 has no heartbeat, so if connection ttl is non zero, data must continue to be sent or connection // will be timed out and closed! String ttlStr = (String) acceptorUsed.getConfiguration().get(TransportConstants.CONNECTION_TTL); Long ttl = ttlStr == null ? null : Long.valueOf(ttlStr); if (ttl != null) { if (ttl > 0) { return new ConnectionEntry(conn, null, System.currentTimeMillis(), ttl); } throw BUNDLE.negativeConnectionTTL(ttl); } ttl = server.getConfiguration().getConnectionTTLOverride(); if (ttl != -1) { return new ConnectionEntry(conn, null, System.currentTimeMillis(), ttl); } else { // Default to 1 minute - which is same as core protocol return new ConnectionEntry(conn, null, System.currentTimeMillis(), 1 * 60 * 1000); } }
private static void compareTTLWithCheckPeriod(Configuration configuration) { for (ClusterConnectionConfiguration c : configuration.getClusterConfigurations()) compareTTLWithCheckPeriod(c.getName(), c.getConnectionTTL(), configuration.getConnectionTTLOverride(), c.getClientFailureCheckPeriod()); for (BridgeConfiguration c : configuration.getBridgeConfigurations()) compareTTLWithCheckPeriod(c.getName(), c.getConnectionTTL(), configuration.getConnectionTTLOverride(), c.getClientFailureCheckPeriod()); }
@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; }
@Override public ConnectionEntry createConnectionEntry(Acceptor acceptorUsed, Connection remotingConnection) { AMQPConnectionCallback connectionCallback = new AMQPConnectionCallback(this, remotingConnection, server.getExecutorFactory().getExecutor(), server); long ttl = ActiveMQClient.DEFAULT_CONNECTION_TTL; if (server.getConfiguration().getConnectionTTLOverride() != -1) { ttl = server.getConfiguration().getConnectionTTLOverride(); } if (getAmqpIdleTimeout() != null) { ttl = getAmqpIdleTimeout().longValue(); } if (ttl < 0) { ttl = 0; } String id = server.getConfiguration().getName(); boolean useCoreSubscriptionNaming = server.getConfiguration().isAmqpUseCoreSubscriptionNaming(); AMQPConnectionContext amqpConnection = new AMQPConnectionContext(this, connectionCallback, id, (int) ttl, getMaxFrameSize(), AMQPConstants.Connection.DEFAULT_CHANNEL_MAX, useCoreSubscriptionNaming, server.getScheduledPool(), true, null, null); Executor executor = server.getExecutorFactory().getExecutor(); ActiveMQProtonRemotingConnection delegate = new ActiveMQProtonRemotingConnection(this, amqpConnection, remotingConnection, executor); delegate.addFailureListener(connectionCallback); delegate.addCloseListener(connectionCallback); connectionCallback.setProtonConnectionDelegate(delegate); // connection entry only understands -1 otherwise we would see disconnects for no reason ConnectionEntry entry = new ConnectionEntry(delegate, executor, System.currentTimeMillis(), ttl <= 0 ? -1 : ttl); return entry; }
@Override public ConnectionEntry createConnectionEntry(Acceptor acceptorUsed, Connection remotingConnection) { AMQPConnectionCallback connectionCallback = new AMQPConnectionCallback(this, remotingConnection, server.getExecutorFactory().getExecutor(), server); long ttl = ActiveMQClient.DEFAULT_CONNECTION_TTL; if (server.getConfiguration().getConnectionTTLOverride() != -1) { ttl = server.getConfiguration().getConnectionTTLOverride(); } if (getAmqpIdleTimeout() != null) { ttl = getAmqpIdleTimeout().longValue(); } if (ttl < 0) { ttl = 0; } String id = server.getConfiguration().getName(); boolean useCoreSubscriptionNaming = server.getConfiguration().isAmqpUseCoreSubscriptionNaming(); AMQPConnectionContext amqpConnection = new AMQPConnectionContext(this, connectionCallback, id, (int) ttl, getMaxFrameSize(), AMQPConstants.Connection.DEFAULT_CHANNEL_MAX, useCoreSubscriptionNaming, server.getScheduledPool(), true, null, null); Executor executor = server.getExecutorFactory().getExecutor(); ActiveMQProtonRemotingConnection delegate = new ActiveMQProtonRemotingConnection(this, amqpConnection, remotingConnection, executor); delegate.addFailureListener(connectionCallback); delegate.addCloseListener(connectionCallback); connectionCallback.setProtonConnectionDelegate(delegate); // connection entry only understands -1 otherwise we would see disconnects for no reason ConnectionEntry entry = new ConnectionEntry(delegate, executor, System.currentTimeMillis(), ttl <= 0 ? -1 : ttl); return entry; }
Ping ping = (Ping) packet; if (config.getConnectionTTLOverride() == -1) {
config.setConnectionTTLOverride(getLong(e, "connection-ttl-override", config.getConnectionTTLOverride(), Validators.MINUS_ONE_OR_GT_ZERO));
Assert.assertEquals(5, conf.getMessageCounterMaxDayHistory()); Assert.assertEquals(123456, conf.getMessageCounterSamplePeriod()); Assert.assertEquals(12345, conf.getConnectionTTLOverride()); Assert.assertEquals(98765, conf.getTransactionTimeout()); Assert.assertEquals(56789, conf.getTransactionTimeoutScanPeriod());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultConnectionTtlOverride(), conf.getConnectionTTLOverride());
Assert.assertEquals(conf.getIncomingInterceptorClassNames().size(), serverControl.getIncomingInterceptorClassNames().length); Assert.assertEquals(conf.getOutgoingInterceptorClassNames().size(), serverControl.getOutgoingInterceptorClassNames().length); Assert.assertEquals(conf.getConnectionTTLOverride(), serverControl.getConnectionTTLOverride());
Assert.assertEquals(l, conf.getConnectionTTLOverride());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultThreadPoolMaxSize(), conf.getThreadPoolMaxSize()); Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultJmxManagementEnabled(), conf.isJMXManagementEnabled()); Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultConnectionTtlOverride(), conf.getConnectionTTLOverride()); Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultAsyncConnectionExecutionEnabled(), conf.isAsyncConnectionExecutionEnabled()); Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultPagingDir(), conf.getPagingDirectory());
Assert.assertEquals(l, conf.getConnectionTTLOverride());