@Override public void handleBuffer(RemotingConnection connection, ActiveMQBuffer buffer) { ActiveMQProtonRemotingConnection protonConnection = (ActiveMQProtonRemotingConnection) connection; protonConnection.bufferReceived(protonConnection.getID(), buffer); }
@Override public void destroy() { synchronized (this) { if (destroyed) { return; } destroyed = true; } callClosingListeners(); internalClose(); }
/** * Disconnect the connection, closing all channels */ @Override public void disconnect(String scaleDownNodeID, boolean criticalError) { disconnect(criticalError); }
public ActiveMQProtonRemotingConnection createConnection(ProtonProtocolManager protocolManager, Connection connection, Optional<EventHandler> eventHandler, ClientSASLFactory clientSASLFactory) { AMQPConnectionCallback connectionCallback = new AMQPConnectionCallback(protocolManager, connection, server.getExecutorFactory().getExecutor(), server); Executor executor = server.getExecutorFactory().getExecutor(); AMQPConnectionContext amqpConnection = new AMQPConnectionContext(protocolManager, connectionCallback, containerId, ttl, protocolManager.getMaxFrameSize(), AMQPConstants.Connection.DEFAULT_CHANNEL_MAX, useCoreSubscriptionNaming, server.getScheduledPool(), false, clientSASLFactory, connectionProperties); eventHandler.ifPresent(amqpConnection::addEventHandler); ActiveMQProtonRemotingConnection delegate = new ActiveMQProtonRemotingConnection(protocolManager, amqpConnection, connection, executor); delegate.addFailureListener(connectionCallback); delegate.addCloseListener(connectionCallback); connectionCallback.setProtonConnectionDelegate(delegate); return delegate; } }
@Override public void connectionCreated(ActiveMQComponent component, Connection connection, ProtonProtocolManager protocolManager) { ActiveMQProtonRemotingConnection amqpConnection = connectionFactory.createConnection(protocolManager, connection, eventHandler, clientSASLFactory); connectionMap.put(connection.getID(), amqpConnection); amqpConnection.open(); log.info("Connection " + amqpConnection.getRemoteAddress() + " created"); }
@Override public void fail(final ActiveMQException me, String scaleDownTargetNodeID) { if (destroyed) { return; } destroyed = true; //filter it like the other protocols if (!(me instanceof ActiveMQRemoteDisconnectException)) { ActiveMQClientLogger.LOGGER.connectionFailureDetected(me.getMessage(), me.getType()); } // Then call the listeners callFailureListeners(me, scaleDownTargetNodeID); callClosingListeners(); internalClose(); }
public Executor getExeuctor() { if (protonConnectionDelegate != null) { return protonConnectionDelegate.getExecutor(); } else { return null; } }
public ActiveMQProtonRemotingConnection createConnection(ProtonProtocolManager protocolManager, Connection connection, Optional<EventHandler> eventHandler, ClientSASLFactory clientSASLFactory) { AMQPConnectionCallback connectionCallback = new AMQPConnectionCallback(protocolManager, connection, server.getExecutorFactory().getExecutor(), server); Executor executor = server.getExecutorFactory().getExecutor(); AMQPConnectionContext amqpConnection = new AMQPConnectionContext(protocolManager, connectionCallback, containerId, ttl, protocolManager.getMaxFrameSize(), AMQPConstants.Connection.DEFAULT_CHANNEL_MAX, useCoreSubscriptionNaming, server.getScheduledPool(), false, clientSASLFactory, connectionProperties); eventHandler.ifPresent(amqpConnection::addEventHandler); ActiveMQProtonRemotingConnection delegate = new ActiveMQProtonRemotingConnection(protocolManager, amqpConnection, connection, executor); delegate.addFailureListener(connectionCallback); delegate.addCloseListener(connectionCallback); connectionCallback.setProtonConnectionDelegate(delegate); return delegate; } }
@Override public void connectionCreated(ActiveMQComponent component, Connection connection, ProtonProtocolManager protocolManager) { ActiveMQProtonRemotingConnection amqpConnection = connectionFactory.createConnection(protocolManager, connection, eventHandler, clientSASLFactory); connectionMap.put(connection.getID(), amqpConnection); amqpConnection.open(); log.info("Connection " + amqpConnection.getRemoteAddress() + " created"); }
@Override public void fail(final ActiveMQException me, String scaleDownTargetNodeID) { if (destroyed) { return; } destroyed = true; //filter it like the other protocols if (!(me instanceof ActiveMQRemoteDisconnectException)) { ActiveMQClientLogger.LOGGER.connectionFailureDetected(me.getMessage(), me.getType()); } // Then call the listeners callFailureListeners(me, scaleDownTargetNodeID); callClosingListeners(); internalClose(); }
public Executor getExeuctor() { if (protonConnectionDelegate != null) { return protonConnectionDelegate.getExecutor(); } else { return null; } }
public ActiveMQProtonRemotingConnection createConnection(ProtonProtocolManager protocolManager, Connection connection, Optional<EventHandler> eventHandler, ClientSASLFactory clientSASLFactory) { AMQPConnectionCallback connectionCallback = new AMQPConnectionCallback(protocolManager, connection, server.getExecutorFactory().getExecutor(), server); Executor executor = server.getExecutorFactory().getExecutor(); AMQPConnectionContext amqpConnection = new AMQPConnectionContext(protocolManager, connectionCallback, containerId, ttl, protocolManager.getMaxFrameSize(), AMQPConstants.Connection.DEFAULT_CHANNEL_MAX, useCoreSubscriptionNaming, server.getScheduledPool(), false, clientSASLFactory, connectionProperties); eventHandler.ifPresent(amqpConnection::addEventHandler); ActiveMQProtonRemotingConnection delegate = new ActiveMQProtonRemotingConnection(protocolManager, amqpConnection, connection, executor); delegate.addFailureListener(connectionCallback); delegate.addCloseListener(connectionCallback); connectionCallback.setProtonConnectionDelegate(delegate); return delegate; } }
@Override public void connectionCreated(ActiveMQComponent component, Connection connection, ProtonProtocolManager protocolManager) { ActiveMQProtonRemotingConnection amqpConnection = connectionFactory.createConnection(protocolManager, connection, eventHandler, clientSASLFactory); connectionMap.put(connection.getID(), amqpConnection); amqpConnection.open(); log.info("Connection " + amqpConnection.getRemoteAddress() + " created"); }
@Override public void handleBuffer(RemotingConnection connection, ActiveMQBuffer buffer) { ActiveMQProtonRemotingConnection protonConnection = (ActiveMQProtonRemotingConnection) connection; protonConnection.bufferReceived(protonConnection.getID(), buffer); }
@Override public void destroy() { synchronized (this) { if (destroyed) { return; } destroyed = true; } callClosingListeners(); internalClose(); }
/** * Disconnect the connection, closing all channels */ @Override public void disconnect(String scaleDownNodeID, boolean criticalError) { disconnect(criticalError); }
@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; }