Merged branch 'jetty-9.3.x' into 'master'.
This commit is contained in:
commit
3ebb391fe1
|
@ -58,7 +58,7 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
*/
|
||||
protected int _desiredInterestOps;
|
||||
|
||||
|
||||
|
||||
private abstract class RunnableTask implements Runnable
|
||||
{
|
||||
final String _operation;
|
||||
|
@ -66,14 +66,14 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
{
|
||||
_operation=op;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return ChannelEndPoint.this.toString()+":"+_operation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private abstract class RejectableRunnable extends RunnableTask implements Rejectable
|
||||
{
|
||||
RejectableRunnable(String op)
|
||||
|
@ -81,7 +81,7 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
super(op);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void reject()
|
||||
{
|
||||
try
|
||||
|
@ -94,7 +94,7 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private final Runnable _runUpdateKey = new RunnableTask("runUpdateKey")
|
||||
{
|
||||
@Override
|
||||
|
@ -127,8 +127,8 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
getFillInterest().fillable();
|
||||
getWriteFlusher().completeWrite();
|
||||
getFillInterest().fillable();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -171,7 +171,7 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
super.doClose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClose()
|
||||
{
|
||||
|
@ -185,7 +185,7 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
_selector.onClose(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int fill(ByteBuffer buffer) throws IOException
|
||||
|
@ -291,7 +291,7 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
/**
|
||||
* This method may run concurrently with {@link #changeInterests(int)}.
|
||||
*/
|
||||
|
||||
|
||||
int readyOps = _key.readyOps();
|
||||
int oldInterestOps;
|
||||
int newInterestOps;
|
||||
|
@ -303,15 +303,15 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
newInterestOps = oldInterestOps & ~readyOps;
|
||||
_desiredInterestOps = newInterestOps;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
boolean readable = (readyOps & SelectionKey.OP_READ) != 0;
|
||||
boolean writable = (readyOps & SelectionKey.OP_WRITE) != 0;
|
||||
|
||||
|
||||
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onSelected {}->{} r={} w={} for {}", oldInterestOps, newInterestOps, readable, writable, this);
|
||||
|
||||
|
||||
// Run non-blocking code immediately.
|
||||
// This producer knows that this non-blocking code is special
|
||||
// and that it must be run in this thread and not fed to the
|
||||
|
@ -331,11 +331,11 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
_runCompleteWrite.run();
|
||||
writable = false;
|
||||
}
|
||||
|
||||
|
||||
// return task to complete the job
|
||||
Runnable task= readable ? (writable ? _runFillableCompleteWrite : _runFillable)
|
||||
: (writable ? _runCompleteWrite : null);
|
||||
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("task {}",task);
|
||||
return task;
|
||||
|
@ -347,7 +347,7 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
/**
|
||||
* This method may run concurrently with {@link #changeInterests(int)}.
|
||||
*/
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
int oldInterestOps;
|
||||
|
@ -363,7 +363,7 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
_key.interestOps(newInterestOps);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Key interests updated {} -> {} on {}", oldInterestOps, newInterestOps, this);
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
* This method may run concurrently with
|
||||
* {@link #updateKey()} and {@link #onSelected()}.
|
||||
*/
|
||||
|
||||
|
||||
int oldInterestOps;
|
||||
int newInterestOps;
|
||||
boolean pending;
|
||||
|
@ -397,14 +397,14 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
if (newInterestOps != oldInterestOps)
|
||||
_desiredInterestOps = newInterestOps;
|
||||
}
|
||||
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("changeInterests p={} {}->{} for {}", pending, oldInterestOps, newInterestOps, this);
|
||||
|
||||
|
||||
if (!pending && _selector!=null)
|
||||
_selector.submit(_runUpdateKey);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
|
@ -427,5 +427,5 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
|
|||
return String.format("%s{io=%s,kio=-2,kro=-2}", super.toString(), _desiredInterestOps);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue