Fixes 310467 (Allow SocketConnector to create generic Connection objects).

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1561 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Simone Bordet 2010-04-26 15:09:17 +00:00
parent fd9b4b8ae9
commit 53b2e8d6c1
2 changed files with 29 additions and 29 deletions

View File

@ -1,5 +1,4 @@
jetty-7.1.0-SNAPSHOT
jetty-7.1-SNAPSHOT
+ 294563 Websocket client connection + 294563 Websocket client connection
+ 297104 Improve handling of CONNECT method + 297104 Improve handling of CONNECT method
+ 306349 ProxyServlet does not work unless deployed at / + 306349 ProxyServlet does not work unless deployed at /
@ -7,7 +6,7 @@ jetty-7.1-SNAPSHOT
+ 307847 Fixed combining mime type parameters + 307847 Fixed combining mime type parameters
+ 307898 Handle large/async websocket messages + 307898 Handle large/async websocket messages
+ 308009 ObjectMBean incorrectly casts getTargetException() to Exception + 308009 ObjectMBean incorrectly casts getTargetException() to Exception
+ 308420 convert jetty-plus.xml to use DeploymentManager + 308420 convert jetty-plus.xml to use DeploymentManager
+ 308925 Protect the test webapp from remote access + 308925 Protect the test webapp from remote access
+ 309466 Removed synchronization from StdErrLog + 309466 Removed synchronization from StdErrLog
+ 309765 Added JSP module + 309765 Added JSP module
@ -18,6 +17,7 @@ jetty-7.1-SNAPSHOT
+ JETTY-1202 Use platform default algorithm for SecureRandom + JETTY-1202 Use platform default algorithm for SecureRandom
+ Fix jetty-plus.xml reference to addLifeCycle + Fix jetty-plus.xml reference to addLifeCycle
+ Add AnnotationConfiguration to jetty-plus.xml + Add AnnotationConfiguration to jetty-plus.xml
+ 310467 Allow SocketConnector to create generic Connection objects
jetty-7.0.2.v20100331 31 March 2010 jetty-7.0.2.v20100331 31 March 2010
+ 297552 Don't call Continuation timeouts from acceptor tick + 297552 Don't call Continuation timeouts from acceptor tick

View File

@ -4,13 +4,13 @@
// All rights reserved. This program and the accompanying materials // All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0 // are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution. // and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at // The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html // http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at // The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php // http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses. // You may elect to redistribute this code under either of these licenses.
// ======================================================================== // ========================================================================
package org.eclipse.jetty.server.bio; package org.eclipse.jetty.server.bio;
import java.io.IOException; import java.io.IOException;
@ -39,21 +39,21 @@ import org.eclipse.jetty.util.log.Log;
* This connector implements a traditional blocking IO and threading model. * This connector implements a traditional blocking IO and threading model.
* Normal JRE sockets are used and a thread is allocated per connection. * Normal JRE sockets are used and a thread is allocated per connection.
* Buffers are managed so that large buffers are only allocated to active connections. * Buffers are managed so that large buffers are only allocated to active connections.
* *
* This Connector should only be used if NIO is not available. * This Connector should only be used if NIO is not available.
* *
* @org.apache.xbean.XBean element="bioConnector" description="Creates a BIO based socket connector" * @org.apache.xbean.XBean element="bioConnector" description="Creates a BIO based socket connector"
* *
* *
*/ */
public class SocketConnector extends AbstractConnector public class SocketConnector extends AbstractConnector
{ {
protected ServerSocket _serverSocket; protected ServerSocket _serverSocket;
protected final Set<EndPoint> _connections; protected final Set<EndPoint> _connections;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Constructor. /** Constructor.
* *
*/ */
public SocketConnector() public SocketConnector()
{ {
@ -65,7 +65,7 @@ public class SocketConnector extends AbstractConnector
{ {
return _serverSocket; return _serverSocket;
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
public void open() throws IOException public void open() throws IOException
{ {
@ -81,10 +81,10 @@ public class SocketConnector extends AbstractConnector
ServerSocket ss= host==null? ServerSocket ss= host==null?
new ServerSocket(port,backlog): new ServerSocket(port,backlog):
new ServerSocket(port,backlog,InetAddress.getByName(host)); new ServerSocket(port,backlog,InetAddress.getByName(host));
return ss; return ss;
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
public void close() throws IOException public void close() throws IOException
{ {
@ -97,10 +97,10 @@ public class SocketConnector extends AbstractConnector
@Override @Override
public void accept(int acceptorID) public void accept(int acceptorID)
throws IOException, InterruptedException throws IOException, InterruptedException
{ {
Socket socket = _serverSocket.accept(); Socket socket = _serverSocket.accept();
configure(socket); configure(socket);
ConnectorEndPoint connection=new ConnectorEndPoint(socket); ConnectorEndPoint connection=new ConnectorEndPoint(socket);
connection.dispatch(); connection.dispatch();
} }
@ -109,7 +109,7 @@ public class SocketConnector extends AbstractConnector
/** /**
* Allows subclass to override Conection if required. * Allows subclass to override Conection if required.
*/ */
protected HttpConnection newHttpConnection(EndPoint endpoint) protected Connection newConnection(EndPoint endpoint)
{ {
return new HttpConnection(this, endpoint, getServer()); return new HttpConnection(this, endpoint, getServer());
} }
@ -126,7 +126,7 @@ public class SocketConnector extends AbstractConnector
connection._sotimeout=lrmit; connection._sotimeout=lrmit;
((Socket)endpoint.getTransport()).setSoTimeout(lrmit); ((Socket)endpoint.getTransport()).setSoTimeout(lrmit);
} }
super.customize(endpoint, request); super.customize(endpoint, request);
} }
@ -157,7 +157,7 @@ public class SocketConnector extends AbstractConnector
{ {
set= new HashSet(_connections); set= new HashSet(_connections);
} }
Iterator iter=set.iterator(); Iterator iter=set.iterator();
while(iter.hasNext()) while(iter.hasNext())
{ {
@ -175,11 +175,11 @@ public class SocketConnector extends AbstractConnector
volatile Connection _connection; volatile Connection _connection;
int _sotimeout; int _sotimeout;
protected final Socket _socket; protected final Socket _socket;
public ConnectorEndPoint(Socket socket) throws IOException public ConnectorEndPoint(Socket socket) throws IOException
{ {
super(socket); super(socket);
_connection = newHttpConnection(this); _connection = newConnection(this);
_sotimeout=socket.getSoTimeout(); _sotimeout=socket.getSoTimeout();
_socket=socket; _socket=socket;
} }
@ -195,7 +195,7 @@ public class SocketConnector extends AbstractConnector
connectionUpgraded(_connection,connection); connectionUpgraded(_connection,connection);
_connection=connection; _connection=connection;
} }
public void dispatch() throws IOException public void dispatch() throws IOException
{ {
if (getThreadPool()==null || !getThreadPool().dispatch(this)) if (getThreadPool()==null || !getThreadPool().dispatch(this))
@ -204,7 +204,7 @@ public class SocketConnector extends AbstractConnector
close(); close();
} }
} }
@Override @Override
public int fill(Buffer buffer) throws IOException public int fill(Buffer buffer) throws IOException
{ {
@ -212,8 +212,8 @@ public class SocketConnector extends AbstractConnector
if (l<0) if (l<0)
close(); close();
return l; return l;
} }
@Override @Override
public void close() throws IOException public void close() throws IOException
{ {
@ -231,7 +231,7 @@ public class SocketConnector extends AbstractConnector
{ {
_connections.add(this); _connections.add(this);
} }
while (isStarted() && !isClosed()) while (isStarted() && !isClosed())
{ {
if (_connection.isIdle()) if (_connection.isIdle())
@ -245,7 +245,7 @@ public class SocketConnector extends AbstractConnector
_socket.setSoTimeout(_sotimeout); _socket.setSoTimeout(_sotimeout);
} }
} }
} }
_connection=_connection.handle(); _connection=_connection.handle();
} }
@ -269,7 +269,7 @@ public class SocketConnector extends AbstractConnector
catch(IOException e2){Log.ignore(e2);} catch(IOException e2){Log.ignore(e2);}
} }
finally finally
{ {
connectionClosed(_connection); connectionClosed(_connection);
synchronized(_connections) synchronized(_connections)
{ {