@Override public void open() throws IOException { if (_acceptChannel == null) { _acceptChannel = openAcceptChannel(); _acceptChannel.configureBlocking(true); _localPort = _acceptChannel.socket().getLocalPort(); if (_localPort <= 0) throw new IOException("Server channel not bound"); addBean(_acceptChannel); } }
private ServerConnector configureConnector() { ServerConnector connector = null; if (m_tls) { connector = createSSLConnector(); } else { // Unsecured connector connector = new ServerConnector(m_jettyServer); } if (m_restaddr != null) { connector.setHost(m_restaddr); } connector.setPort(m_restport); connector.setIdleTimeout(SOCKET_TIMEOUT_MILLIS); connector.addBean(new ConnListener()); // invokes registered callbacks, if any return connector; } // configureConnector
@Override public void open() throws IOException { if (_acceptChannel == null) { ServerSocketChannel serverChannel = null; if (isInheritChannel()) { Channel channel = System.inheritedChannel(); if (channel instanceof ServerSocketChannel) serverChannel = (ServerSocketChannel)channel; else LOG.warn("Unable to use System.inheritedChannel() [{}]. Trying a new ServerSocketChannel at {}:{}", channel, getHost(), getPort()); } if (serverChannel == null) { serverChannel = ServerSocketChannel.open(); InetSocketAddress bindAddress = getHost() == null ? new InetSocketAddress(getPort()) : new InetSocketAddress(getHost(), getPort()); serverChannel.socket().setReuseAddress(getReuseAddress()); serverChannel.socket().bind(bindAddress, getAcceptQueueSize()); _localPort = serverChannel.socket().getLocalPort(); if (_localPort <= 0) throw new IOException("Server channel not bound"); addBean(serverChannel); } serverChannel.configureBlocking(true); addBean(serverChannel); _acceptChannel = serverChannel; } }
@Override public void open() throws IOException { if (_acceptChannel == null) { ServerSocketChannel serverChannel = null; if (isInheritChannel()) { Channel channel = System.inheritedChannel(); if (channel instanceof ServerSocketChannel) serverChannel = (ServerSocketChannel)channel; else LOG.warn("Unable to use System.inheritedChannel() [{}]. Trying a new ServerSocketChannel at {}:{}", channel, getHost(), getPort()); } if (serverChannel == null) { serverChannel = ServerSocketChannel.open(); InetSocketAddress bindAddress = getHost() == null ? new InetSocketAddress(getPort()) : new InetSocketAddress(getHost(), getPort()); serverChannel.socket().setReuseAddress(getReuseAddress()); serverChannel.socket().bind(bindAddress, getAcceptQueueSize()); _localPort = serverChannel.socket().getLocalPort(); if (_localPort <= 0) throw new IOException("Server channel not bound"); addBean(serverChannel); } serverChannel.configureBlocking(true); addBean(serverChannel); _acceptChannel = serverChannel; } }
@Override public void open() throws IOException { if (_acceptChannel == null) { ServerSocketChannel serverChannel = null; if (isInheritChannel()) { Channel channel = System.inheritedChannel(); if (channel instanceof ServerSocketChannel) serverChannel = (ServerSocketChannel)channel; else LOG.warn("Unable to use System.inheritedChannel() [{}]. Trying a new ServerSocketChannel at {}:{}", channel, getHost(), getPort()); } if (serverChannel == null) { serverChannel = ServerSocketChannel.open(); InetSocketAddress bindAddress = getHost() == null ? new InetSocketAddress(getPort()) : new InetSocketAddress(getHost(), getPort()); serverChannel.socket().bind(bindAddress, getAcceptQueueSize()); serverChannel.socket().setReuseAddress(getReuseAddress()); _localPort = serverChannel.socket().getLocalPort(); if (_localPort <= 0) throw new IOException("Server channel not bound"); addBean(serverChannel); } serverChannel.configureBlocking(true); addBean(serverChannel); _acceptChannel = serverChannel; } }
@Override public void childAdded(final ConfiguredObject<?> object, final ConfiguredObject<?> child) { if (child instanceof HttpPort) { final HttpPort<?> port = (HttpPort<?>) child; Server server = _server; if (server != null) { ServerConnector connector = null; try { connector = createConnector(port, server); connector.addBean(new ConnectionTrackingListener()); server.addConnector(connector); connector.start(); _portConnectorMap.put(port, connector); logOperationalListenMessages(port, connector.getLocalPort()); } catch (Exception e) { if (connector != null) { server.removeConnector(connector); } LOGGER.warn("HTTP management connector creation failed for http port {}", port, e); } } } }
@Override public void open() throws IOException { if (_acceptChannel == null) { ServerSocketChannel serverChannel = null; if (isInheritChannel()) { Channel channel = System.inheritedChannel(); if (channel instanceof ServerSocketChannel) serverChannel = (ServerSocketChannel)channel; else LOG.warn("Unable to use System.inheritedChannel() [{}]. Trying a new ServerSocketChannel at {}:{}", channel, getHost(), getPort()); } if (serverChannel == null) { serverChannel = ServerSocketChannel.open(); InetSocketAddress bindAddress = getHost() == null ? new InetSocketAddress(getPort()) : new InetSocketAddress(getHost(), getPort()); serverChannel.socket().bind(bindAddress, getAcceptQueueSize()); serverChannel.socket().setReuseAddress(getReuseAddress()); _localPort = serverChannel.socket().getLocalPort(); if (_localPort <= 0) throw new IOException("Server channel not bound"); addBean(serverChannel); } serverChannel.configureBlocking(true); addBean(serverChannel); _acceptChannel = serverChannel; } }
private void configureConnector(final ServerConnector connector, int port) { connector.setPort(port); connector.setHost(this.config.getHost()); connector.setIdleTimeout(this.config.getHttpTimeout()); if (this.config.isRegisterMBeans()) { connector.addBean(new ConnectionStatistics()); } }
_manager = new ServerConnectorManager(getExecutor(), getScheduler(), selectors>0?selectors:Math.max(1,Math.min(4,Runtime.getRuntime().availableProcessors()/2))); addBean(_manager, true);
_manager = newSelectorManager(getExecutor(), getScheduler(), selectors>0?selectors:Math.max(1,Math.min(4,Runtime.getRuntime().availableProcessors()/2))); addBean(_manager, true); setAcceptorPriorityDelta(-2);
addBean(_manager, true);
sslContextFactory.setWantClientAuth(_port.getWantClientAuth()); connector = new ServerConnector(_server, sslContextFactory, httpConnectionFactory); connector.addBean(new SslHandshakeListener()
addBean(_manager, true);
httpConnector.setIdleTimeout(httpMaxIdle); httpConnector.setAcceptQueueSize(httpAcceptQueueSize); httpConnector.addBean(new ConnectorStatistics()); httpsConnector.setIdleTimeout(httpsMaxIdle); httpsConnector.setAcceptQueueSize(httpsAcceptQueueSize); httpsConnector.addBean(new ConnectorStatistics());
connector.addBean(new ConnectionTrackingListener()); server.addConnector(connector); _portConnectorMap.put(port, connector);
addBean(_manager, true); setAcceptorPriorityDelta(-2);
connector.addBean(new SslHandshakeListener()