@Override public synchronized void startAcceptors() throws Exception { if (isStarted()) { for (Acceptor a : acceptors.values()) { a.start(); } } }
@Override public void connectionClosed() { acceptorUsed.getClusterConnection().removeClusterTopologyListener(listener); } });
StompConnection(final Acceptor acceptorUsed, final Connection transportConnection, final StompProtocolManager manager, final ScheduledExecutorService scheduledExecutorService, final ExecutorFactory factory) { this.scheduledExecutorService = scheduledExecutorService; this.factory = factory; this.transportConnection = transportConnection; this.manager = manager; this.frameHandler = new StompFrameHandlerV10(this, scheduledExecutorService, factory); this.creationTime = System.currentTimeMillis(); this.acceptorUsed = acceptorUsed; this.enableMessageID = ConfigurationHelper.getBooleanProperty(TransportConstants.STOMP_ENABLE_MESSAGE_ID, false, acceptorUsed.getConfiguration()); this.minLargeMessageSize = ConfigurationHelper.getIntProperty(TransportConstants.STOMP_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, acceptorUsed.getConfiguration()); }
@Override public synchronized void allowInvmSecurityOverride(ActiveMQPrincipal principal) { defaultInvmSecurityPrincipal = principal; for (Acceptor acceptor : acceptors.values()) { if (acceptor.isUnsecurable()) { acceptor.setDefaultActiveMQPrincipal(principal); } } }
if (defaultInvmSecurityPrincipal != null && acceptor.isUnsecurable()) { acceptor.setDefaultActiveMQPrincipal(defaultInvmSecurityPrincipal); acceptor.setNotificationService(managementService);
@Override public void reload() { clearIO(); try { acceptor.reload(); } finally { blockOnIO(); } }
@Override public boolean isStarted() { clearIO(); try { return acceptor.isStarted(); } finally { blockOnIO(); } }
public static void main(String[] args) throws Exception { // FooApplication is your class that implements the Application interface FooApplication application = new FooApplication(); SessionSettings settings = new SessionSettings(new FileInputStream(fileName)); MessageStoreFactory storeFactory = new FileStoreFactory(settings); LogFactory[] logFactories = new LogFactory[] {new FileLogFactory(settings)}; LogFactory logFactory = new CompositeLogFactory(logFactories); MessageFactory messageFactory = new DefaultMessageFactory(); Acceptor acceptor = new SocketAcceptor(application, storeFactory, settings, logFactory, messageFactory); acceptor.start();
StompConnection(final Acceptor acceptorUsed, final Connection transportConnection, final StompProtocolManager manager, final ScheduledExecutorService scheduledExecutorService, final ExecutorFactory factory) { this.scheduledExecutorService = scheduledExecutorService; this.factory = factory; this.transportConnection = transportConnection; this.manager = manager; this.frameHandler = new StompFrameHandlerV10(this, scheduledExecutorService, factory); this.creationTime = System.currentTimeMillis(); this.acceptorUsed = acceptorUsed; this.enableMessageID = ConfigurationHelper.getBooleanProperty(TransportConstants.STOMP_ENABLE_MESSAGE_ID, false, acceptorUsed.getConfiguration()); this.minLargeMessageSize = ConfigurationHelper.getIntProperty(TransportConstants.STOMP_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, acceptorUsed.getConfiguration()); }
@Override public void handlePacket(Packet packet) { if (packet.getType() == PacketImpl.BACKUP_REGISTRATION) { BackupRegistrationMessage msg = (BackupRegistrationMessage) packet; ClusterConnection clusterConnection = acceptorUsed.getClusterConnection(); try { startReplication(channel.getConnection(), clusterConnection, getPair(msg.getConnector(), true), msg.isFailBackRequest()); } catch (ActiveMQAlreadyReplicatingException are) { channel.send(new BackupReplicationStartFailedMessage(BackupReplicationStartFailedMessage.BackupRegistrationProblem.ALREADY_REPLICATING)); } catch (ActiveMQException e) { logger.debug("Failed to process backup registration packet", e); channel.send(new BackupReplicationStartFailedMessage(BackupReplicationStartFailedMessage.BackupRegistrationProblem.EXCEPTION)); } } } };
@Override public void start() throws Exception { clearIO(); try { acceptor.start(); } finally { blockOnIO(); } }
StompSession(final StompConnection connection, final StompProtocolManager manager, OperationContext sessionContext) { this.connection = connection; this.manager = manager; this.sessionContext = sessionContext; this.consumerCredits = ConfigurationHelper.getIntProperty(TransportConstants.STOMP_CONSUMERS_CREDIT, TransportConstants.STOMP_DEFAULT_CONSUMERS_CREDIT, connection.getAcceptorUsed().getConfiguration()); }
if (acceptorUsed.getClusterConnection() != null) { acceptorUsed.getClusterConnection().addClusterTopologyListener(listener);
initiator.start();
StompSession(final StompConnection connection, final StompProtocolManager manager, OperationContext sessionContext) { this.connection = connection; this.manager = manager; this.sessionContext = sessionContext; this.consumerCredits = ConfigurationHelper.getIntProperty(TransportConstants.STOMP_CONSUMERS_CREDIT, TransportConstants.STOMP_DEFAULT_CONSUMERS_CREDIT, connection.getAcceptorUsed().getConfiguration()); }
ClusterConnection clusterConnection = acceptorUsed.getClusterConnection(); ClusterConnection clusterConn = acceptorUsed.getClusterConnection(); if (clusterConn != null) { String scaleDownGroupName = msg.getScaleDownGroupName();
@Override public void setUp() throws Exception { super.setUp(); server.getRemotingService().createAcceptor("test", "tcp://127.0.0.1:" + wsport + "?stompMaxFramePayloadLength=" + stompWSMaxFrameSize).start(); wsURI = createStompClientUri(scheme, hostname, wsport); }
String heartBeatToTtlModifierStr = (String) connection.getAcceptorUsed().getConfiguration().get(TransportConstants.HEART_BEAT_TO_CONNECTION_TTL_MODIFIER); double heartBeatToTtlModifier = heartBeatToTtlModifierStr == null ? 2 : Double.valueOf(heartBeatToTtlModifierStr); String ttlMaxStr = (String) connection.getAcceptorUsed().getConfiguration().get(TransportConstants.CONNECTION_TTL_MAX); long ttlMax = ttlMaxStr == null ? Long.MAX_VALUE : Long.valueOf(ttlMaxStr); String ttlMinStr = (String) connection.getAcceptorUsed().getConfiguration().get(TransportConstants.CONNECTION_TTL_MIN); long ttlMin = ttlMinStr == null ? 1000 : Long.valueOf(ttlMinStr);