Class AbstractEndPoint
- All Implemented Interfaces:
Closeable,AutoCloseable,EndPoint
- Direct Known Subclasses:
ByteArrayEndPoint,QuicStreamEndPoint,SelectableChannelEndPoint,SslConnection.DecryptedEndPoint
Partial implementation of EndPoint that uses FillInterest and WriteFlusher.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.EndPoint
EndPoint.Wrapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()Close any backing stream associated with the endpointfinal voidClose any backing stream associated with the endpoint, passing a causeprotected voiddoClose()protected voidprotected voidvoidfillInterested(Callback callback) Requests callback methods to be invoked when a call toEndPoint.fill(ByteBuffer)would return data or EOF.longbooleanbooleanTest if the input is shutdown.booleanisOpen()This abstract method should be called to check if idle timeouts should still be checked.booleanTest if output is shutdown.protected abstract voidfinal voidonClose()voidCallback method invoked when thisEndPointis closed.protected voidonIdleExpired(TimeoutException timeout) This abstract method is called when the idle timeout has expired.protected abstract voidvoidonOpen()Callback method invoked when this EndPoint is opened.protected voidreset()voidsetConnection(Connection connection) protected final voidfinal voidShutdown the output.toString()booleantryFillInterested(Callback callback) Requests callback methods to be invoked when a call toEndPoint.fill(ByteBuffer)would return data or EOF.voidupgrade(Connection newConnection) Upgrades this EndPoint from the current connection to the given new connection.voidwrite(Callback callback, ByteBuffer... buffers) Writes the given buffers viaEndPoint.flush(ByteBuffer...)and invokes callback methods when either all the data has been flushed or an error occurs.Methods inherited from class org.eclipse.jetty.io.IdleTimeout
checkIdleTimeout, getIdleFor, getIdleTimeout, getScheduler, notIdle, setIdleTimeoutMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.io.EndPoint
fill, flush, getIdleTimeout, getTransport, setIdleTimeout
-
Constructor Details
-
AbstractEndPoint
-
-
Method Details
-
getLocalAddress
- Specified by:
getLocalAddressin interfaceEndPoint- Returns:
- The local InetSocketAddress to which this
EndPointis bound, ornullif thisEndPointis not bound to a Socket address.
-
getLocalSocketAddress
- Specified by:
getLocalSocketAddressin interfaceEndPoint- Returns:
- the local SocketAddress to which this
EndPointis bound ornullif thisEndPointis not bound to a Socket address.
-
getRemoteAddress
- Specified by:
getRemoteAddressin interfaceEndPoint- Returns:
- The remote InetSocketAddress to which this
EndPointis connected, ornullif thisEndPointis not connected to a Socket address.
-
getRemoteSocketAddress
- Specified by:
getRemoteSocketAddressin interfaceEndPoint- Returns:
- The remote SocketAddress to which this
EndPointis connected, ornullif thisEndPointis not connected to a Socket address.
-
shutdownInput
protected final void shutdownInput() -
shutdownOutput
public final void shutdownOutput()Description copied from interface:EndPointShutdown the output.This call indicates that no more data will be sent on this endpoint that that the remote end should read an EOF once all previously sent data has been consumed. Shutdown may be done either at the TCP/IP level, as a protocol exchange (Eg TLS close handshake) or both.
If the endpoint has
EndPoint.isInputShutdown()true, then this call has the same effect asEndPoint.close().- Specified by:
shutdownOutputin interfaceEndPoint
-
close
public final void close()Description copied from interface:EndPointClose any backing stream associated with the endpoint -
close
Description copied from interface:EndPointClose any backing stream associated with the endpoint, passing a cause -
doShutdownInput
protected void doShutdownInput() -
doShutdownOutput
protected void doShutdownOutput() -
doClose
protected void doClose() -
isOutputShutdown
public boolean isOutputShutdown()Description copied from interface:EndPointTest if output is shutdown. The output is shutdown by a call toEndPoint.shutdownOutput()orEndPoint.close().- Specified by:
isOutputShutdownin interfaceEndPoint- Returns:
- true if the output is shutdown or the endpoint is closed.
-
isInputShutdown
public boolean isInputShutdown()Description copied from interface:EndPointTest if the input is shutdown. The input is shutdown if an EOF has been read while doing aEndPoint.fill(ByteBuffer). Once the input is shutdown, all calls toEndPoint.fill(ByteBuffer)will return -1, until such time as the end point is close, when they will returnEofException.- Specified by:
isInputShutdownin interfaceEndPoint- Returns:
- True if the input is shutdown or the endpoint is closed.
-
isOpen
public boolean isOpen()Description copied from class:IdleTimeoutThis abstract method should be called to check if idle timeouts should still be checked.- Specified by:
isOpenin interfaceEndPoint- Specified by:
isOpenin classIdleTimeout- Returns:
- True if the entity monitored should still be checked for idle timeouts
-
getCreatedTimeStamp
public long getCreatedTimeStamp()- Specified by:
getCreatedTimeStampin interfaceEndPoint- Returns:
- the epoch time in milliseconds when this EndPoint was created
-
getConnection
- Specified by:
getConnectionin interfaceEndPoint- Returns:
- the
Connectionassociated with this EndPoint - See Also:
-
setConnection
- Specified by:
setConnectionin interfaceEndPoint- Parameters:
connection- theConnectionassociated with this EndPoint- See Also:
-
reset
protected void reset() -
onOpen
public void onOpen()Description copied from interface:EndPointCallback method invoked when this EndPoint is opened.
- Specified by:
onOpenin interfaceEndPoint- Overrides:
onOpenin classIdleTimeout- See Also:
-
onClose
public final void onClose()- Overrides:
onClosein classIdleTimeout
-
onClose
Description copied from interface:EndPointCallback method invoked when this
EndPointis closed. -
fillInterested
Description copied from interface:EndPointRequests callback methods to be invoked when a call to
EndPoint.fill(ByteBuffer)would return data or EOF.- Specified by:
fillInterestedin interfaceEndPoint- Parameters:
callback- the callback to call when an error occurs or we are readable. The callback may implement theInvocableinterface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
-
tryFillInterested
Description copied from interface:EndPointRequests callback methods to be invoked when a call to
EndPoint.fill(ByteBuffer)would return data or EOF.- Specified by:
tryFillInterestedin interfaceEndPoint- Parameters:
callback- the callback to call when an error occurs or we are readable. The callback may implement theInvocableinterface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.- Returns:
- true if set
-
isFillInterested
public boolean isFillInterested()- Specified by:
isFillInterestedin interfaceEndPoint- Returns:
- whether
EndPoint.fillInterested(Callback)has been called, butEndPoint.fill(ByteBuffer)has not yet been called
-
write
Description copied from interface:EndPointWrites the given buffers via
EndPoint.flush(ByteBuffer...)and invokes callback methods when either all the data has been flushed or an error occurs.- Specified by:
writein interfaceEndPoint- Parameters:
callback- the callback to call when an error occurs or the write completed. The callback may implement theInvocableinterface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.buffers- one or moreByteBuffers that will be flushed.- Throws:
WritePendingException- if another write operation is concurrent.
-
onIncompleteFlush
protected abstract void onIncompleteFlush() -
needsFillInterest
- Throws:
IOException
-
getFillInterest
-
getWriteFlusher
-
onIdleExpired
Description copied from class:IdleTimeoutThis abstract method is called when the idle timeout has expired.- Specified by:
onIdleExpiredin classIdleTimeout- Parameters:
timeout- a TimeoutException
-
upgrade
Description copied from interface:EndPointUpgrades this EndPoint from the current connection to the given new connection.
Closes the current connection, links this EndPoint to the new connection and then opens the new connection.
If the current connection is an instance of
Connection.UpgradeFromthen a buffer of unconsumed bytes is requested. If the buffer of unconsumed bytes is non-null and non-empty, then the new connection is tested: if it is an instance ofConnection.UpgradeTo, then the unconsumed buffer is passed to the new connection; otherwise, an exception is thrown since there are unconsumed bytes that cannot be consumed by the new connection. -
toString
-
toEndPointString
-
toConnectionString
-