@Override public void closed() { protocolManager.removeHandler(name); }
/** * This will update the list of interceptors for each ProtocolManager inside the acceptor. */ @Override public void updateInterceptors(List<BaseInterceptor> incomingInterceptors, List<BaseInterceptor> outgoingInterceptors) { for (ProtocolManager manager : protocolMap.values()) { manager.updateInterceptors(incomingInterceptors, outgoingInterceptors); } }
public ProtocolHandler(Map<String, ProtocolManager> protocolMap, NettyAcceptor nettyAcceptor, ScheduledExecutorService scheduledThreadPool) { this.protocolMap = protocolMap; this.nettyAcceptor = nettyAcceptor; this.scheduledThreadPool = scheduledThreadPool; websocketSubprotocolIds = new ArrayList<>(); for (ProtocolManager pm : protocolMap.values()) { if (pm.websocketSubprotocolIdentifiers() != null) { websocketSubprotocolIds.addAll(pm.websocketSubprotocolIdentifiers()); } } }
if (protocolManager.isProtocol(bytes)) { protocolToUse = protocol; break; if (entry.getValue().acceptsNoHandshake()) { protocolToUse = entry.getKey(); break; protocolManagerToUse.addChannelHandlers(pipeline); pipeline.addLast("handler", channelHandler); NettyServerConnection connection = channelHandler.createConnection(ctx, protocolToUse, httpEnabled); protocolManagerToUse.handshake(connection, new ChannelBufferWrapper(in)); pipeline.remove(this);
@Override public void connectionCreated(final ActiveMQComponent component, final Connection connection, final ProtocolManager protocol) { if (server == null) { throw new IllegalStateException("Unable to create connection, server hasn't finished starting up"); } ConnectionEntry entry = protocol.createConnectionEntry((Acceptor) component, connection); try { if (server.hasBrokerConnectionPlugins()) { server.callBrokerConnectionPlugins(plugin -> plugin.afterCreateConnection(entry.connection)); } } catch (ActiveMQException t) { logger.warn("Error executing afterCreateConnection plugin method: {}", t.getMessage(), t); throw new IllegalStateException(t.getMessage(), t.getCause()); } if (logger.isTraceEnabled()) { logger.trace("Connection created " + connection); } connections.put(connection.getID(), entry); connectionCountLatch.countUp(); totalConnectionCount.incrementAndGet(); }