mirror of
https://github.com/jetty/jetty.project.git
synced 2025-03-01 11:29:29 +00:00
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:
parent
0e67706c27
commit
99f078d0ee
@ -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
|
||||
|
@ -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!");
|
||||
updateKey();
|
||||
}
|
||||
}
|
||||
|
||||
_dispatched = _manager.dispatch((Runnable)this);
|
||||
if(!_dispatched)
|
||||
Log.warn("Dispatched Failed!");
|
||||
return _dispatched;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
@ -681,7 +681,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);
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user