protect event schedule race

This commit is contained in:
Greg Wilkins 2015-02-26 15:37:51 +11:00
parent 752973931e
commit af70c4bd48
3 changed files with 12 additions and 15 deletions

View File

@ -291,7 +291,7 @@ public class HttpChannelState
protected Action unhandle()
{
Action action;
boolean schedule_timeout=false;
AsyncContextEvent schedule_event=null;
boolean read_interested=false;
if(DEBUG)
@ -346,7 +346,7 @@ public class HttpChannelState
}
else
{
schedule_timeout=true;
schedule_event=_event;
read_interested=_asyncReadUnready;
_state=State.ASYNC_WAIT;
action = Action.WAIT;
@ -354,7 +354,7 @@ public class HttpChannelState
break;
case EXPIRING:
schedule_timeout=true;
schedule_event=_event;
_state=State.ASYNC_WAIT;
action = Action.WAIT;
break;
@ -372,8 +372,8 @@ public class HttpChannelState
}
}
if (schedule_timeout)
scheduleTimeout();
if (schedule_event!=null)
scheduleTimeout(schedule_event);
if (read_interested)
_channel.asyncReadFillInterested();
return action;
@ -611,11 +611,11 @@ public class HttpChannelState
_channel.execute(_channel);
}
protected void scheduleTimeout()
protected void scheduleTimeout(AsyncContextEvent event)
{
Scheduler scheduler = _channel.getScheduler();
if (scheduler!=null && _timeoutMs>0)
_event.setTimeoutTask(scheduler.schedule(_event,_timeoutMs,TimeUnit.MILLISECONDS));
event.setTimeoutTask(scheduler.schedule(event,_timeoutMs,TimeUnit.MILLISECONDS));
}
protected void cancelTimeout()

View File

@ -19,7 +19,6 @@
package org.eclipse.jetty.server;
import java.io.IOException;
import java.lang.ref.Reference;
import java.nio.ByteBuffer;
import java.nio.channels.WritePendingException;
import java.util.concurrent.RejectedExecutionException;
@ -259,7 +258,6 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
}
}
/* ------------------------------------------------------------ */
/** Fill and parse data looking for content
* @throws IOException

View File

@ -126,7 +126,6 @@ public class HttpInputIntegrationTest
// HTTP/2 Connector
ServerConnector http2Connector =
new ServerConnector(__server,ssl,/*TODO alpn,h2,*/ h1);
http2Connector.setPort(8443);
__server.addConnector(http2Connector);