Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project

This commit is contained in:
Jesse McConnell 2012-03-19 08:24:08 -05:00
commit 8e0dd32286
6 changed files with 36 additions and 11 deletions

View File

@ -276,6 +276,11 @@ class SelectConnector extends AggregateLifeCycle implements HttpClient.Connector
_endp.shutdownOutput(); _endp.shutdownOutput();
} }
public void dispatch()
{
_endp.asyncDispatch();
}
public void asyncDispatch() public void asyncDispatch()
{ {
_endp.asyncDispatch(); _endp.asyncDispatch();

View File

@ -19,7 +19,14 @@ public interface AsyncEndPoint extends ConnectedEndPoint
{ {
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Dispatch the endpoint to a thread to attend to it. * Dispatch the endpoint if it is not already dispatched
*
*/
public void dispatch();
/* ------------------------------------------------------------ */
/**
* Dispatch the endpoint. If it is already dispatched, schedule a redispatch
* *
*/ */
public void asyncDispatch(); public void asyncDispatch();

View File

@ -208,11 +208,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
{ {
synchronized(this) synchronized(this)
{ {
if (_dispatched) if (!_dispatched)
{
throw new IllegalStateException("dispatched");
}
else
{ {
_dispatched = true; _dispatched = true;
boolean dispatched = _manager.dispatch(_handler); boolean dispatched = _manager.dispatch(_handler);

View File

@ -412,7 +412,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
// If we are reading into the temp buffer and it has some content, then we should be dispatched. // If we are reading into the temp buffer and it has some content, then we should be dispatched.
if (toFill==_unwrapBuf && _unwrapBuf.hasContent() && !_connection.isSuspended()) if (toFill==_unwrapBuf && _unwrapBuf.hasContent() && !_connection.isSuspended())
_aEndp.asyncDispatch(); _aEndp.dispatch();
} }
finally finally
{ {
@ -721,6 +721,11 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
process(null, null); process(null, null);
} }
public void dispatch()
{
_aEndp.dispatch();
}
public void asyncDispatch() public void asyncDispatch()
{ {
_aEndp.asyncDispatch(); _aEndp.asyncDispatch();

View File

@ -32,6 +32,11 @@ public class EmptyAsyncEndPoint implements AsyncEndPoint
private boolean closed; private boolean closed;
private int maxIdleTime; private int maxIdleTime;
@Override
public void dispatch()
{
}
@Override @Override
public void asyncDispatch() public void asyncDispatch()
{ {

View File

@ -350,10 +350,17 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
public static void dumpObject(Appendable out,Object o) throws IOException public static void dumpObject(Appendable out,Object o) throws IOException
{ {
if (o instanceof LifeCycle) try
out.append(String.valueOf(o)).append(" - ").append((AbstractLifeCycle.getState((LifeCycle)o))).append("\n"); {
else if (o instanceof LifeCycle)
out.append(String.valueOf(o)).append("\n"); out.append(String.valueOf(o)).append(" - ").append((AbstractLifeCycle.getState((LifeCycle)o))).append("\n");
else
out.append(String.valueOf(o)).append("\n");
}
catch(Throwable th)
{
out.append(" => ").append(th.toString()).append('\n');
}
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */