cleanup of dispatch code

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@406 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2009-06-16 08:09:19 +00:00
parent 0e67706c27
commit 99f078d0ee
4 changed files with 18 additions and 14 deletions

View File

@ -19,9 +19,8 @@ public interface AsyncEndPoint extends EndPoint
/**
* Dispatch the endpoint to a thread to attend to it.
*
* @return True If the dispatched succeeded
*/
public boolean dispatch();
public void dispatch();
/**
* @return true if this endpoint can accept a dispatch. False if the

View File

@ -124,26 +124,29 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements Runnable,
_writable = true; // Once writable is in ops, only removed with dispatch.
}
if (!dispatch())
updateKey();
if (_dispatched)
_key.interestOps(0);
else
dispatch();
}
}
/* ------------------------------------------------------------ */
public boolean dispatch()
public void dispatch()
{
synchronized(this)
{
if (_dispatched)
{
_redispatched=true;
return true;
}
else
{
_dispatched = _manager.dispatch((Runnable)this);
if(!_dispatched)
{
Log.warn("Dispatched Failed!");
return _dispatched;
updateKey();
}
}
}
}
@ -151,6 +154,8 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements Runnable,
/**
* Called when a dispatched thread is no longer handling the endpoint.
* The selection key operations are updated.
* @return If false is returned, the endpoint has been redispatched and
* thread must keep handling the endpoint.
*/
protected boolean undispatch()
{

View File

@ -682,7 +682,6 @@ public class HttpConnection implements Connection
return _generator;
}
/* ------------------------------------------------------------ */
public boolean isIncluding()
{
@ -777,6 +776,7 @@ public class HttpConnection implements Connection
}
catch (Exception e)
{
Log.warn(e);
throw new HttpException(HttpStatus.BAD_REQUEST_400,null,e);
}
}

View File

@ -303,7 +303,7 @@ public class StressTest extends TestCase
String status = "min/ave/max/target="+min+"/"+(total/threads)+"/"+max+"/"+loops+" errors/finished/loops="+errors+"/"+finished+"/"+threads+" idle/threads="+(_threads.getIdleThreads())+"/"+_threads.getThreads();
if (status.equals(last))
{
if (same++>10)
if (same++>5)
{
System.err.println("STALLED!!!");
System.err.println(_server.getThreadPool().toString());