comparison src/org/eclipse/jetty/server/nio/SelectChannelConnector.java @ 914:54308d65265a

simplify SelectorManager
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 09 Oct 2016 01:22:55 -0600
parents 17f4fe8271de
children 0541b6034003
comparison
equal deleted inserted replaced
913:17f4fe8271de 914:54308d65265a
112 protected synchronized void doStart() throws Exception 112 protected synchronized void doStart() throws Exception
113 { 113 {
114 _manager.setSelectSets(getAcceptors()); 114 _manager.setSelectSets(getAcceptors());
115 _manager.setMaxIdleTime(getMaxIdleTime()); 115 _manager.setMaxIdleTime(getMaxIdleTime());
116 _manager.setLowResourcesConnections(0); 116 _manager.setLowResourcesConnections(0);
117 _manager.setLowResourcesMaxIdleTime(0);
118 117
119 if (_acceptChannel == null) 118 if (_acceptChannel == null)
120 { 119 {
121 // Create a new server socket 120 // Create a new server socket
122 _acceptChannel = ServerSocketChannel.open(); 121 _acceptChannel = ServerSocketChannel.open();
125 124
126 // Bind the server socket to the local host and port 125 // Bind the server socket to the local host and port
127 _acceptChannel.socket().setReuseAddress(true); 126 _acceptChannel.socket().setReuseAddress(true);
128 InetSocketAddress addr = getHost()==null?new InetSocketAddress(port):new InetSocketAddress(getHost(),port); 127 InetSocketAddress addr = getHost()==null?new InetSocketAddress(port):new InetSocketAddress(getHost(),port);
129 _acceptChannel.bind(addr); 128 _acceptChannel.bind(addr);
130
131 if( _acceptChannel.socket().getLocalPort() != port) 129 if( _acceptChannel.socket().getLocalPort() != port)
132 throw new IOException("Server channel not bound"); 130 throw new IOException("Server channel not bound");
133 } 131 }
134 132
135 super.doStart(); 133 super.doStart();
166 { 164 {
167 SelectChannelConnector.this.endPointClosed(endpoint); 165 SelectChannelConnector.this.endPointClosed(endpoint);
168 } 166 }
169 167
170 @Override 168 @Override
171 protected void endPointOpened(SelectChannelEndPoint endpoint)
172 {
173 }
174
175 @Override
176 protected void endPointUpgraded(ConnectedEndPoint endpoint, Connection oldConnection)
177 {
178 }
179
180 @Override
181 public AsyncConnection newConnection(SocketChannel channel,AsyncEndPoint endpoint, Object attachment) 169 public AsyncConnection newConnection(SocketChannel channel,AsyncEndPoint endpoint, Object attachment)
182 { 170 {
183 return SelectChannelConnector.this.newConnection(channel,endpoint); 171 return SelectChannelConnector.this.newConnection(channel,endpoint);
184 } 172 }
185 173