jetty-9 renamed ReadInterest to fillInterest
This commit is contained in:
parent
29833f000b
commit
7df281bb16
|
@ -51,7 +51,7 @@ public class ByteArrayEndPoint extends AbstractEndPoint
|
||||||
protected boolean _growOutput;
|
protected boolean _growOutput;
|
||||||
|
|
||||||
|
|
||||||
private final ReadInterest _readInterest = new ReadInterest()
|
private final FillInterest _fillInterest = new FillInterest()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected boolean needsFill() throws IOException
|
protected boolean needsFill() throws IOException
|
||||||
|
@ -150,7 +150,7 @@ public class ByteArrayEndPoint extends AbstractEndPoint
|
||||||
{
|
{
|
||||||
_in = in;
|
_in = in;
|
||||||
if (in == null || BufferUtil.hasContent(in))
|
if (in == null || BufferUtil.hasContent(in))
|
||||||
_readInterest.readable();
|
_fillInterest.readable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -356,7 +356,7 @@ public class ByteArrayEndPoint extends AbstractEndPoint
|
||||||
*/
|
*/
|
||||||
public void reset()
|
public void reset()
|
||||||
{
|
{
|
||||||
_readInterest.close();
|
_fillInterest.close();
|
||||||
_writeFlusher.onClose();
|
_writeFlusher.onClose();
|
||||||
_ishut=false;
|
_ishut=false;
|
||||||
_oshut=false;
|
_oshut=false;
|
||||||
|
@ -426,7 +426,7 @@ public class ByteArrayEndPoint extends AbstractEndPoint
|
||||||
long idleElapsed = System.currentTimeMillis() - idleTimestamp;
|
long idleElapsed = System.currentTimeMillis() - idleTimestamp;
|
||||||
long idleLeft = idleTimeout - idleElapsed;
|
long idleLeft = idleTimeout - idleElapsed;
|
||||||
|
|
||||||
if (isOutputShutdown() || _readInterest.isInterested() || _writeFlusher.isInProgress())
|
if (isOutputShutdown() || _fillInterest.isInterested() || _writeFlusher.isInProgress())
|
||||||
{
|
{
|
||||||
if (idleTimestamp != 0 && idleTimeout > 0)
|
if (idleTimestamp != 0 && idleTimeout > 0)
|
||||||
{
|
{
|
||||||
|
@ -435,7 +435,7 @@ public class ByteArrayEndPoint extends AbstractEndPoint
|
||||||
LOG.debug("{} idle timeout expired", this);
|
LOG.debug("{} idle timeout expired", this);
|
||||||
|
|
||||||
TimeoutException timeout = new TimeoutException("Idle timeout expired: " + idleElapsed + "/" + idleTimeout + " ms");
|
TimeoutException timeout = new TimeoutException("Idle timeout expired: " + idleElapsed + "/" + idleTimeout + " ms");
|
||||||
_readInterest.failed(timeout);
|
_fillInterest.failed(timeout);
|
||||||
_writeFlusher.onFail(timeout);
|
_writeFlusher.onFail(timeout);
|
||||||
|
|
||||||
if (isOutputShutdown())
|
if (isOutputShutdown())
|
||||||
|
@ -454,7 +454,7 @@ public class ByteArrayEndPoint extends AbstractEndPoint
|
||||||
@Override
|
@Override
|
||||||
public <C> void fillInterested(C context, Callback<C> callback) throws IllegalStateException
|
public <C> void fillInterested(C context, Callback<C> callback) throws IllegalStateException
|
||||||
{
|
{
|
||||||
_readInterest.register(context, callback);
|
_fillInterest.register(context, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
|
@ -14,14 +14,14 @@ import org.eclipse.jetty.util.Callback;
|
||||||
* by keeping state and calling the context and callback objects.
|
* by keeping state and calling the context and callback objects.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class ReadInterest
|
public abstract class FillInterest
|
||||||
{
|
{
|
||||||
private final AtomicBoolean _interested = new AtomicBoolean(false);
|
private final AtomicBoolean _interested = new AtomicBoolean(false);
|
||||||
private volatile Callback<Object> _callback;
|
private volatile Callback<Object> _callback;
|
||||||
private Object _context;
|
private Object _context;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
protected ReadInterest()
|
protected FillInterest()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
|
||||||
* true if {@link ManagedSelector#destroyEndPoint(EndPoint)} has not been called
|
* true if {@link ManagedSelector#destroyEndPoint(EndPoint)} has not been called
|
||||||
*/
|
*/
|
||||||
private final AtomicBoolean _open = new AtomicBoolean();
|
private final AtomicBoolean _open = new AtomicBoolean();
|
||||||
private final ReadInterest _readInterest = new ReadInterest()
|
private final FillInterest _fillInterest = new FillInterest()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected boolean needsFill()
|
protected boolean needsFill()
|
||||||
|
@ -150,7 +150,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
|
||||||
@Override
|
@Override
|
||||||
public <C> void fillInterested(C context, Callback<C> callback) throws IllegalStateException
|
public <C> void fillInterested(C context, Callback<C> callback) throws IllegalStateException
|
||||||
{
|
{
|
||||||
_readInterest.register(context, callback);
|
_fillInterest.register(context, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -178,7 +178,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
|
||||||
setKeyInterests(oldInterestOps, newInterestOps);
|
setKeyInterests(oldInterestOps, newInterestOps);
|
||||||
updateLocalInterests(readyOps, false);
|
updateLocalInterests(readyOps, false);
|
||||||
if (_key.isReadable())
|
if (_key.isReadable())
|
||||||
_readInterest.readable();
|
_fillInterest.readable();
|
||||||
if (_key.isWritable())
|
if (_key.isWritable())
|
||||||
_writeFlusher.completeWrite();
|
_writeFlusher.completeWrite();
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
|
||||||
|
|
||||||
LOG.debug("{} idle timeout check, elapsed: {} ms, remaining: {} ms", this, idleElapsed, idleLeft);
|
LOG.debug("{} idle timeout check, elapsed: {} ms, remaining: {} ms", this, idleElapsed, idleLeft);
|
||||||
|
|
||||||
if (isOutputShutdown() || _readInterest.isInterested() || _writeFlusher.isInProgress())
|
if (isOutputShutdown() || _fillInterest.isInterested() || _writeFlusher.isInProgress())
|
||||||
{
|
{
|
||||||
if (idleTimestamp != 0 && idleTimeout > 0)
|
if (idleTimestamp != 0 && idleTimeout > 0)
|
||||||
{
|
{
|
||||||
|
@ -203,7 +203,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
|
||||||
LOG.debug("{} idle timeout expired", this);
|
LOG.debug("{} idle timeout expired", this);
|
||||||
|
|
||||||
TimeoutException timeout = new TimeoutException("Idle timeout expired: " + idleElapsed + "/" + idleTimeout + " ms");
|
TimeoutException timeout = new TimeoutException("Idle timeout expired: " + idleElapsed + "/" + idleTimeout + " ms");
|
||||||
_readInterest.failed(timeout);
|
_fillInterest.failed(timeout);
|
||||||
_writeFlusher.onFail(timeout);
|
_writeFlusher.onFail(timeout);
|
||||||
|
|
||||||
if (isOutputShutdown())
|
if (isOutputShutdown())
|
||||||
|
@ -269,7 +269,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
|
||||||
{
|
{
|
||||||
super.onClose();
|
super.onClose();
|
||||||
_writeFlusher.onClose();
|
_writeFlusher.onClose();
|
||||||
_readInterest.close();
|
_fillInterest.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -292,6 +292,6 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
|
||||||
}
|
}
|
||||||
return String.format("SCEP@%x{l(%s)<->r(%s),open=%b,ishut=%b,oshut=%b,i=%d%s,r=%s,w=%s}-{%s}",
|
return String.format("SCEP@%x{l(%s)<->r(%s),open=%b,ishut=%b,oshut=%b,i=%d%s,r=%s,w=%s}-{%s}",
|
||||||
hashCode(), getRemoteAddress(), getLocalAddress(), isOpen(), isInputShutdown(),
|
hashCode(), getRemoteAddress(), getLocalAddress(), isOpen(), isInputShutdown(),
|
||||||
isOutputShutdown(), _interestOps, keyString, _readInterest, _writeFlusher, getConnection());
|
isOutputShutdown(), _interestOps, keyString, _fillInterest, _writeFlusher, getConnection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,10 +67,14 @@ abstract public class WriteFlusher
|
||||||
// will discover the failure and call the callbacks before returning to IDLE
|
// will discover the failure and call the callbacks before returning to IDLE
|
||||||
// Thus the possible paths for a failure are:
|
// Thus the possible paths for a failure are:
|
||||||
//
|
//
|
||||||
// IDLE--(fail)-->IDLE
|
// IDLE--(fail)-->IDLE
|
||||||
// IDLE-->WRITING--(fail)-->FAILED-->IDLE
|
// IDLE-->WRITING--(fail)-->FAILED-->IDLE
|
||||||
// IDLE-->WRITING-->PENDING--(fail)-->IDLE
|
// IDLE-->WRITING-->PENDING--(fail)-->IDLE
|
||||||
// IDLE-->WRITING-->PENDING-->COMPLETING--(fail)-->FAILED-->IDLE
|
// IDLE-->WRITING-->PENDING-->COMPLETING--(fail)-->FAILED-->IDLE
|
||||||
|
//
|
||||||
|
// So a call to fail in the PENDING state will be directly handled and the state changed to IDLE
|
||||||
|
// A call to fail in the WRITING or COMPLETING states will just set the state to FAILED and the failure will be
|
||||||
|
// handled with the write or completeWrite methods try to move the state from what they thought it was.
|
||||||
//
|
//
|
||||||
|
|
||||||
protected WriteFlusher(EndPoint endPoint)
|
protected WriteFlusher(EndPoint endPoint)
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.eclipse.jetty.io.Connection;
|
||||||
import org.eclipse.jetty.io.ByteBufferPool;
|
import org.eclipse.jetty.io.ByteBufferPool;
|
||||||
import org.eclipse.jetty.io.EndPoint;
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
import org.eclipse.jetty.io.EofException;
|
import org.eclipse.jetty.io.EofException;
|
||||||
import org.eclipse.jetty.io.ReadInterest;
|
import org.eclipse.jetty.io.FillInterest;
|
||||||
import org.eclipse.jetty.io.RuntimeIOException;
|
import org.eclipse.jetty.io.RuntimeIOException;
|
||||||
import org.eclipse.jetty.io.SelectChannelEndPoint;
|
import org.eclipse.jetty.io.SelectChannelEndPoint;
|
||||||
import org.eclipse.jetty.io.WriteFlusher;
|
import org.eclipse.jetty.io.WriteFlusher;
|
||||||
|
@ -138,8 +138,8 @@ public class SslConnection extends AbstractConnection
|
||||||
{
|
{
|
||||||
// wake up whoever is doing the fill or the flush so they can
|
// wake up whoever is doing the fill or the flush so they can
|
||||||
// do all the filling, unwrapping ,wrapping and flushing
|
// do all the filling, unwrapping ,wrapping and flushing
|
||||||
if (_decryptedEndPoint._readInterest.isInterested())
|
if (_decryptedEndPoint._fillInterest.isInterested())
|
||||||
_decryptedEndPoint._readInterest.readable();
|
_decryptedEndPoint._fillInterest.readable();
|
||||||
|
|
||||||
// If we are handshaking, then wake up any waiting write as well as it may have been blocked on the read
|
// If we are handshaking, then wake up any waiting write as well as it may have been blocked on the read
|
||||||
if ( _decryptedEndPoint._flushRequiresFillToProgress)
|
if ( _decryptedEndPoint._flushRequiresFillToProgress)
|
||||||
|
@ -164,8 +164,8 @@ public class SslConnection extends AbstractConnection
|
||||||
|
|
||||||
synchronized(_decryptedEndPoint)
|
synchronized(_decryptedEndPoint)
|
||||||
{
|
{
|
||||||
if (_decryptedEndPoint._readInterest.isInterested())
|
if (_decryptedEndPoint._fillInterest.isInterested())
|
||||||
_decryptedEndPoint._readInterest.failed(cause);
|
_decryptedEndPoint._fillInterest.failed(cause);
|
||||||
|
|
||||||
if (_decryptedEndPoint._flushRequiresFillToProgress)
|
if (_decryptedEndPoint._flushRequiresFillToProgress)
|
||||||
{
|
{
|
||||||
|
@ -182,12 +182,12 @@ public class SslConnection extends AbstractConnection
|
||||||
return String.format("SslConnection@%x{%s,%s%s}",
|
return String.format("SslConnection@%x{%s,%s%s}",
|
||||||
hashCode(),
|
hashCode(),
|
||||||
_sslEngine.getHandshakeStatus(),
|
_sslEngine.getHandshakeStatus(),
|
||||||
_decryptedEndPoint._readInterest.isInterested() ? "R" : "",
|
_decryptedEndPoint._fillInterest.isInterested() ? "R" : "",
|
||||||
_decryptedEndPoint._writeFlusher.isInProgress() ? "W" : "");
|
_decryptedEndPoint._writeFlusher.isInProgress() ? "W" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public class DecryptedEndPoint extends AbstractEndPoint implements EndPoint
|
public class DecryptedEndPoint extends AbstractEndPoint
|
||||||
{
|
{
|
||||||
private boolean _fillRequiresFlushToProgress;
|
private boolean _fillRequiresFlushToProgress;
|
||||||
private boolean _flushRequiresFillToProgress;
|
private boolean _flushRequiresFillToProgress;
|
||||||
|
@ -215,7 +215,7 @@ public class SslConnection extends AbstractConnection
|
||||||
if (_fillRequiresFlushToProgress)
|
if (_fillRequiresFlushToProgress)
|
||||||
{
|
{
|
||||||
_fillRequiresFlushToProgress = false;
|
_fillRequiresFlushToProgress = false;
|
||||||
_readInterest.readable();
|
_fillInterest.readable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_writeFlusher.isInProgress())
|
if (_writeFlusher.isInProgress())
|
||||||
|
@ -241,7 +241,7 @@ public class SslConnection extends AbstractConnection
|
||||||
if (_fillRequiresFlushToProgress)
|
if (_fillRequiresFlushToProgress)
|
||||||
{
|
{
|
||||||
_fillRequiresFlushToProgress = false;
|
_fillRequiresFlushToProgress = false;
|
||||||
_readInterest.failed(x);
|
_fillInterest.failed(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_writeFlusher.isInProgress())
|
if (_writeFlusher.isInProgress())
|
||||||
|
@ -252,7 +252,7 @@ public class SslConnection extends AbstractConnection
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final ReadInterest _readInterest = new ReadInterest()
|
private final FillInterest _fillInterest = new FillInterest()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected boolean needsFill() throws IOException
|
protected boolean needsFill() throws IOException
|
||||||
|
@ -350,7 +350,7 @@ public class SslConnection extends AbstractConnection
|
||||||
@Override
|
@Override
|
||||||
public <C> void fillInterested(C context, Callback<C> callback) throws IllegalStateException
|
public <C> void fillInterested(C context, Callback<C> callback) throws IllegalStateException
|
||||||
{
|
{
|
||||||
_readInterest.register(context, callback);
|
_fillInterest.register(context, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -619,7 +619,7 @@ public class SslConnection extends AbstractConnection
|
||||||
case NEED_UNWRAP:
|
case NEED_UNWRAP:
|
||||||
// Ah we need to fill some data so we can write.
|
// Ah we need to fill some data so we can write.
|
||||||
// So if we were not called from fill and the app is not reading anyway
|
// So if we were not called from fill and the app is not reading anyway
|
||||||
if (!_fillRequiresFlushToProgress && !_readInterest.isInterested())
|
if (!_fillRequiresFlushToProgress && !_fillInterest.isInterested())
|
||||||
{
|
{
|
||||||
// Tell the onFillable method that there might be a write to complete
|
// Tell the onFillable method that there might be a write to complete
|
||||||
// TODO move this to the writeFlusher?
|
// TODO move this to the writeFlusher?
|
||||||
|
@ -706,7 +706,7 @@ public class SslConnection extends AbstractConnection
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return String.format("%s{%s%s%s}", super.toString(), _readInterest.isInterested() ? "R" : "", _writeFlusher.isInProgress() ? "W" : "", _cannotAcceptMoreAppDataToFlush ? "w" : "");
|
return String.format("%s{%s%s%s}", super.toString(), _fillInterest.isInterested() ? "R" : "", _writeFlusher.isInProgress() ? "W" : "", _cannotAcceptMoreAppDataToFlush ? "w" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue