private static Connector connectorMock( String name ) { Connector connector = mock( Connector.class ); when( connector.getName() ).thenReturn( name ); when( connector.getExecutor() ).thenReturn( Runnable::run ); when( connector.getServer() ).thenReturn( new Server() ); return connector; } }
@Override protected void handshake(final Runnable handler) throws Exception { /** Infinite timeout because the continuation is never resumed but only completed on close. */ req.getAsyncContext().setTimeout(0L); /** Server sent events headers. */ rsp.setStatus(HttpServletResponse.SC_OK); rsp.setHeader("Connection", "Close"); rsp.setContentType("text/event-stream; charset=utf-8"); rsp.flushBuffer(); HttpChannel channel = rsp.getHttpChannel(); Connector connector = channel.getConnector(); Executor executor = connector.getExecutor(); executor.execute(handler); }
protected NegotiatingServerConnection(Connector connector, EndPoint endPoint, SSLEngine engine, List<String> protocols, String defaultProtocol) { super(endPoint, connector.getExecutor()); this.connector = connector; this.protocols = protocols; this.defaultProtocol = defaultProtocol; this.engine = engine; }
protected ProxyConnection(EndPoint endp, Connector connector, String next) { super(endp,connector.getExecutor()); _connector=connector; _next=next; }
protected NegotiatingServerConnection(Connector connector, EndPoint endPoint, SSLEngine engine, List<String> protocols, String defaultProtocol) { super(endPoint, connector.getExecutor()); this.connector = connector; this.protocols = protocols; this.defaultProtocol = defaultProtocol; this.engine = engine; }
protected NegotiatingServerConnection(Connector connector, EndPoint endPoint, SSLEngine engine, List<String> protocols, String defaultProtocol) { super(endPoint, connector.getExecutor()); this.connector = connector; this.protocols = protocols; this.defaultProtocol = defaultProtocol; this.engine = engine; }
protected ProxyProtocolV1orV2Connection(EndPoint endp, Connector connector, String next) { super(endp, connector.getExecutor()); _connector = connector; _next = next; }
protected void execute(Runnable task) { _connector.getExecutor().execute(task); }
protected void execute(Runnable task) { _connector.getExecutor().execute(task); }
protected void execute(Runnable task) { _connector.getExecutor().execute(task); }
private static void checkSufficientThreads(Connector connector, String name) { if (connector == null) { return; } Executor executor = connector.getExecutor(); if (executor instanceof ThreadPool) { ThreadPool queuedThreadPool = (ThreadPool) executor; checkState(!queuedThreadPool.isLowOnThreads(), "insufficient threads configured for %s connector", name); } }
private ServerSPDYConnection(Connector connector, EndPoint endPoint, Parser parser, ServerSessionFrameListener listener, boolean dispatchIO, int bufferSize) { super(endPoint, connector.getByteBufferPool(), parser, connector.getExecutor(), dispatchIO, bufferSize); this.listener = listener; }
protected ProxyProtocolV1Connection(EndPoint endp, Connector connector, String next, ByteBuffer buffer) { super(endp, connector.getExecutor()); _connector = connector; _next = next; _length = buffer.remaining(); parse(buffer); }
protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine); }
protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine); }
private SslConnection newSslConnection(final Connector connector, final EndPoint endPoint, final SSLEngine engine) { return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine); }
protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine); }
protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine); }
protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()); }
public HttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint, HttpCompliance compliance, boolean recordComplianceViolations) { super(endPoint, connector.getExecutor()); _config = config; _connector = connector; _bufferPool = _connector.getByteBufferPool(); _generator = newHttpGenerator(); _channel = newHttpChannel(); _input = _channel.getRequest().getHttpInput(); _parser = newHttpParser(compliance); _recordHttpComplianceViolations = recordComplianceViolations; if (LOG.isDebugEnabled()) LOG.debug("New HTTP Connection {}", this); }