Cleaned up Interest enum
This commit is contained in:
Greg Wilkins 2017-02-09 23:59:14 +11:00
parent e7c0e2b288
commit 046cbe4bc6
1 changed files with 10 additions and 8 deletions

View File

@ -103,17 +103,15 @@ public class HttpChannelState
{
NONE(false),
NEEDED(true),
INTERESTED(true);
REGISTERED(true);
final boolean _interested;
boolean isInterested() { return _interested;}
boolean notInterested() { return !_interested;}
Interest(boolean interest)
{
_interested = interest;
}
}
private final boolean DEBUG=LOG.isDebugEnabled();
@ -452,7 +450,7 @@ public class HttpChannelState
action=Action.WAIT;
if (_asyncRead==Interest.NEEDED)
{
_asyncRead=Interest.INTERESTED;
_asyncRead=Interest.REGISTERED;
read_interested=true;
}
Scheduler scheduler=_channel.getScheduler();
@ -1143,13 +1141,13 @@ public class HttpChannelState
LOG.debug("onReadUnready {}",toStringLocked());
// We were already unready, this is not a state change, so do nothing
if (_asyncRead!=Interest.INTERESTED)
if (_asyncRead!=Interest.REGISTERED)
{
_asyncReadPossible=false; // Assumes this has been checked in isReady() with lock held
if (_state==State.ASYNC_WAIT)
{
interested=true;
_asyncRead=Interest.INTERESTED;
_asyncRead=Interest.REGISTERED;
}
else
_asyncRead=Interest.NEEDED;
@ -1200,7 +1198,7 @@ public class HttpChannelState
if(DEBUG)
LOG.debug("onReadReady {}",toStringLocked());
_asyncRead=Interest.INTERESTED;
_asyncRead=Interest.REGISTERED;
_asyncReadPossible=true;
if (_state==State.ASYNC_WAIT)
{
@ -1228,9 +1226,13 @@ public class HttpChannelState
{
woken=true;
_state=State.ASYNC_WOKEN;
_asyncRead=Interest.INTERESTED;
_asyncRead=Interest.REGISTERED;
_asyncReadPossible=true;
}
else
{
_asyncRead=Interest.REGISTERED;
}
}
return woken;
}