/** * Setup a connector for the bind address/port. * * @param connector * @param bindAddress * @param port */ private static void setupConnector(AbstractConnector connector, String bindAddress, int port) { if (bindAddress != null) { connector.setHost(bindAddress.toString()); } connector.setPort(port); // Don't share ports with an existing process. connector.setReuseAddress(false); // Linux keeps the port blocked after shutdown if we don't disable this. connector.setSoLingerTime(0); }
public String getName() { if (_name==null) _name= (getHost()==null?"0.0.0.0":getHost())+":"+(getLocalPort()<=0?getPort():getLocalPort()); return _name; }
connector.setPort(port); connector.setAcceptQueueSize(50); connector.open(); return connector; } catch (IOException e) {
/** * Configures the internal Jetty connector. * * @param connector * The internal Jetty connector. */ protected void configure(AbstractConnector connector) { if (getHelped().getAddress() != null) { connector.setHost(getHelped().getAddress()); } connector.setPort(getHelped().getPort()); connector.setLowResourceMaxIdleTime(getLowResourceMaxIdleTimeMs()); connector.setAcceptors(getAcceptorThreads()); connector.setAcceptQueueSize(getAcceptQueueSize()); connector.setHeaderBufferSize(getHeaderBufferSize()); connector.setRequestBufferSize(getRequestBufferSize()); connector.setResponseBufferSize(getResponseBufferSize()); connector.setMaxIdleTime(getIoMaxIdleTimeMs()); connector.setSoLingerTime(getSoLingerTime()); }
jettyConnector.setLowResourceMaxIdleTime(1500); jettyConnector.setPort(portNum); jettyConnector.setReuseAddress(true);
while (isRunning() && getConnection()!=null) accept(_acceptor); close();
int connectorPort = connector.getLocalPort(); if (connector.getLocalPort() < 0) { branch.log(TreeLogger.ERROR, String.format( "Failed to connect to open channel with port %d (return value %d)", port, connectorPort)); if (connector.getConnection() == null) { branch.log(TreeLogger.TRACE, "Connection is null");
open(); _acceptorThread=new Thread[getAcceptors()];
@Override public void start() throws Exception { if (this.connector == null) { this.connector = createConnector(); configure(this.connector); getWrappedServer().addConnector(this.connector); } getWrappedServer().start(); setEphemeralPort(this.connector.getLocalPort()); }
public String toString() { String name = this.getClass().getName(); int dot = name.lastIndexOf('.'); if (dot>0) name=name.substring(dot+1); return name+"@"+(getHost()==null?"0.0.0.0":getHost())+":"+(getLocalPort()<=0?getPort():getLocalPort()); }