Top Description Inners Fields Constructors Methods
org.eclipse.jetty.io

public abstract Class AbstractEndPoint

extends IdleTimeout
implements EndPoint
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.io.EndPoint, java.io.Closeable, java.lang.AutoCloseable
Known Direct Subclasses
org.eclipse.jetty.io.ByteArrayEndPoint, org.eclipse.jetty.io.SelectableChannelEndPoint, org.eclipse.jetty.io.ssl.SslConnection.SslEndPoint
Imports
java.io.IOException, java.net.InetSocketAddress, .SocketAddress, java.nio.ByteBuffer, java.nio.channels.WritePendingException, java.util.concurrent.TimeoutException, java.util.concurrent.atomic.AtomicReference, org.eclipse.jetty.util.BufferUtil, .Callback, org.eclipse.jetty.util.thread.Scheduler, org.slf4j.Logger, .LoggerFactory

Partial implementation of EndPoint that uses FillInterest and WriteFlusher.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private volatile Connection
private final long
private final FillInterest
private final AtomicReference<AbstractEndPoint.State>
private final WriteFlusher
private static final Logger

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public final void
close()

Overrides default org.eclipse.jetty.io.EndPoint.close.

Close any backing stream associated with the endpoint
public final void
close(Throwable
the reason for the close or null
failure
)

Implements org.eclipse.jetty.io.EndPoint.close.

Close any backing stream associated with the endpoint, passing a cause
protected void
private void
protected void
protected void
public void
fillInterested(Callback
the callback to call when an error occurs or we are readable. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
callback
)

Implements org.eclipse.jetty.io.EndPoint.fillInterested.

Requests callback methods to be invoked when a call to fill(ByteBuffer) would return data or EOF.

public Connection
public long
public FillInterest
public InetSocketAddress
public abstract SocketAddress
public InetSocketAddress
public abstract SocketAddress
public WriteFlusher
public boolean
public boolean
isInputShutdown()

Implements org.eclipse.jetty.io.EndPoint.isInputShutdown.

Test if the input is shutdown.
public boolean
isOpen()

Implements abstract org.eclipse.jetty.io.IdleTimeout.isOpen.

Implements org.eclipse.jetty.io.EndPoint.isOpen.

This abstract method should be called to check if idle timeouts should still be checked.
public boolean
isOutputShutdown()

Implements org.eclipse.jetty.io.EndPoint.isOutputShutdown.

Test if output is shutdown.
protected abstract void
public final void
public void
onClose(Throwable
The reason for the close, or null if a normal close.
failure
)

Implements org.eclipse.jetty.io.EndPoint.onClose.

Callback method invoked when this EndPoint is closed.

protected void
onIdleExpired(TimeoutException
a TimeoutException
timeout
)

Implements abstract org.eclipse.jetty.io.IdleTimeout.onIdleExpired.

This abstract method is called when the idle timeout has expired.
protected abstract void
public void
onOpen()

Overrides org.eclipse.jetty.io.IdleTimeout.onOpen.

Implements org.eclipse.jetty.io.EndPoint.onOpen.

Callback method invoked when this EndPoint is opened.

protected void
public void
setConnection(Connection
the Connection associated with this EndPoint
connection
)

Implements org.eclipse.jetty.io.EndPoint.setConnection.

protected final void
public final void
public String
public String
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public boolean
tryFillInterested(Callback
the callback to call when an error occurs or we are readable. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
callback
)

Implements org.eclipse.jetty.io.EndPoint.tryFillInterested.

Requests callback methods to be invoked when a call to fill(ByteBuffer) would return data or EOF.

public void
upgrade(Connection
the connection to upgrade to
newConnection
)

Implements org.eclipse.jetty.io.EndPoint.upgrade.

Upgrades this EndPoint from the current connection to the given new connection.

public void
write(Callback
the callback to call when an error occurs or the write completed. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
callback
,
ByteBuffer...
one or more ByteBuffers that will be flushed.
buffers
)

Overrides default org.eclipse.jetty.io.EndPoint.write.

Writes the given buffers via flush(ByteBuffer...) and invokes callback methods when either all the data has been flushed or an error occurs.

Inherited from org.eclipse.jetty.io.IdleTimeout:
checkIdleTimeoutgetIdleForgetIdleTimeoutgetSchedulernotIdlesetIdleTimeout

Field Detail

_connectionback to summary
private volatile Connection _connection
_createdback to summary
private final long _created
_fillInterestback to summary
private final FillInterest _fillInterest
_stateback to summary
private final AtomicReference<AbstractEndPoint.State> _state
_writeFlusherback to summary
private final WriteFlusher _writeFlusher
LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.io.IdleTimeout.LOG.

Constructor Detail

AbstractEndPointback to summary
protected AbstractEndPoint(Scheduler scheduler)

Method Detail

closeback to summary
public final void close()

Overrides default org.eclipse.jetty.io.EndPoint.close.

Doc from org.eclipse.jetty.io.EndPoint.close.

Close any backing stream associated with the endpoint

Annotations
@Override
closeback to summary
public final void close(Throwable failure)

Implements org.eclipse.jetty.io.EndPoint.close.

Doc from org.eclipse.jetty.io.EndPoint.close.

Close any backing stream associated with the endpoint, passing a cause

Parameters
failure:Throwable

the reason for the close or null

doCloseback to summary
protected void doClose()
doOnCloseback to summary
private void doOnClose(Throwable failure)
doShutdownInputback to summary
protected void doShutdownInput()
doShutdownOutputback to summary
protected void doShutdownOutput()
fillInterestedback to summary
public void fillInterested(Callback callback)

Implements org.eclipse.jetty.io.EndPoint.fillInterested.

Doc from org.eclipse.jetty.io.EndPoint.fillInterested.

Requests callback methods to be invoked when a call to fill(ByteBuffer) would return data or EOF.

Parameters
callback:Callback

the callback to call when an error occurs or we are readable. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.

Annotations
@Override
getConnectionback to summary
public Connection getConnection()

Implements org.eclipse.jetty.io.EndPoint.getConnection.

Returns:Connection

Doc from org.eclipse.jetty.io.EndPoint.getConnection.

the Connection associated with this EndPoint

Annotations
@Override
getCreatedTimeStampback to summary
public long getCreatedTimeStamp()

Implements org.eclipse.jetty.io.EndPoint.getCreatedTimeStamp.

Returns:long

Doc from org.eclipse.jetty.io.EndPoint.getCreatedTimeStamp.

the epoch time in milliseconds when this EndPoint was created

Annotations
@Override
getFillInterestback to summary
public FillInterest getFillInterest()
getLocalAddressback to summary
public InetSocketAddress getLocalAddress()

Implements org.eclipse.jetty.io.EndPoint.getLocalAddress.

Returns:InetSocketAddress

Doc from org.eclipse.jetty.io.EndPoint.getLocalAddress.

The local InetSocketAddress to which this EndPoint is bound, or null if this EndPoint is not bound to a Socket address.

Annotations
@Override
getLocalSocketAddressback to summary
public abstract SocketAddress getLocalSocketAddress()

Redeclares as abstract: org.eclipse.jetty.io.EndPoint.getLocalSocketAddress.

Returns:SocketAddress

Doc from org.eclipse.jetty.io.EndPoint.getLocalSocketAddress.

the local SocketAddress to which this EndPoint is bound or null if this EndPoint is not bound to a Socket address.

Annotations
@Override
getRemoteAddressback to summary
public InetSocketAddress getRemoteAddress()

Implements org.eclipse.jetty.io.EndPoint.getRemoteAddress.

Returns:InetSocketAddress

Doc from org.eclipse.jetty.io.EndPoint.getRemoteAddress.

The remote InetSocketAddress to which this EndPoint is connected, or null if this EndPoint is not connected to a Socket address.

Annotations
@Override
getRemoteSocketAddressback to summary
public abstract SocketAddress getRemoteSocketAddress()

Redeclares as abstract: org.eclipse.jetty.io.EndPoint.getRemoteSocketAddress.

Returns:SocketAddress

Doc from org.eclipse.jetty.io.EndPoint.getRemoteSocketAddress.

The remote SocketAddress to which this EndPoint is connected, or null if this EndPoint is not connected to a Socket address.

Annotations
@Override
getWriteFlusherback to summary
public WriteFlusher getWriteFlusher()
isFillInterestedback to summary
public boolean isFillInterested()

Implements org.eclipse.jetty.io.EndPoint.isFillInterested.

Returns:boolean

Doc from org.eclipse.jetty.io.EndPoint.isFillInterested.

whether fillInterested(Callback) has been called, but fill(ByteBuffer) has not yet been called

Annotations
@Override
isInputShutdownback to summary
public boolean isInputShutdown()

Implements org.eclipse.jetty.io.EndPoint.isInputShutdown.

Doc from org.eclipse.jetty.io.EndPoint.isInputShutdown.

Test if the input is shutdown. The input is shutdown if an EOF has been read while doing a fill(ByteBuffer). Once the input is shutdown, all calls to fill(ByteBuffer) will return -1, until such time as the end point is close, when they will return EofException.

Returns:boolean

True if the input is shutdown or the endpoint is closed.

Annotations
@Override
isOpenback to summary
public boolean isOpen()

Implements abstract org.eclipse.jetty.io.IdleTimeout.isOpen.

Implements org.eclipse.jetty.io.EndPoint.isOpen.

Doc from org.eclipse.jetty.io.IdleTimeout.isOpen.

This abstract method should be called to check if idle timeouts should still be checked.

Returns:boolean

Doc from org.eclipse.jetty.io.EndPoint.isOpen.

whether this EndPoint is open

Annotations
@Override
isOutputShutdownback to summary
public boolean isOutputShutdown()

Implements org.eclipse.jetty.io.EndPoint.isOutputShutdown.

Doc from org.eclipse.jetty.io.EndPoint.isOutputShutdown.

Test if output is shutdown. The output is shutdown by a call to shutdownOutput() or close().

Returns:boolean

true if the output is shutdown or the endpoint is closed.

Annotations
@Override
needsFillInterestback to summary
protected abstract void needsFillInterest() throws IOException
onCloseback to summary
public final void onClose()

Overrides org.eclipse.jetty.io.IdleTimeout.onClose.

Annotations
@Override
onCloseback to summary
public void onClose(Throwable failure)

Implements org.eclipse.jetty.io.EndPoint.onClose.

Doc from org.eclipse.jetty.io.EndPoint.onClose.

Callback method invoked when this EndPoint is closed.

Parameters
failure:Throwable

The reason for the close, or null if a normal close.

Annotations
@Override
onIdleExpiredback to summary
protected void onIdleExpired(TimeoutException timeout)

Implements abstract org.eclipse.jetty.io.IdleTimeout.onIdleExpired.

Doc from org.eclipse.jetty.io.IdleTimeout.onIdleExpired.

This abstract method is called when the idle timeout has expired.

Parameters
timeout:TimeoutException

a TimeoutException

Annotations
@Override
onIncompleteFlushback to summary
protected abstract void onIncompleteFlush()
onOpenback to summary
public void onOpen()

Overrides org.eclipse.jetty.io.IdleTimeout.onOpen.

Implements org.eclipse.jetty.io.EndPoint.onOpen.

Doc from org.eclipse.jetty.io.EndPoint.onOpen.

Callback method invoked when this EndPoint is opened.

Annotations
@Override
resetback to summary
protected void reset()
setConnectionback to summary
public void setConnection(Connection connection)

Implements org.eclipse.jetty.io.EndPoint.setConnection.

Parameters
connection:Connection

Doc from org.eclipse.jetty.io.EndPoint.setConnection.

the Connection associated with this EndPoint

Annotations
@Override
shutdownInputback to summary
protected final void shutdownInput()
shutdownOutputback to summary
public final void shutdownOutput()

Implements org.eclipse.jetty.io.EndPoint.shutdownOutput.

Doc from org.eclipse.jetty.io.EndPoint.shutdownOutput.

Shutdown 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 isInputShutdown() true, then this call has the same effect as close().

Annotations
@Override
toConnectionStringback to summary
public String toConnectionString()
toEndPointStringback to summary
public String toEndPointString()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
tryFillInterestedback to summary
public boolean tryFillInterested(Callback callback)

Implements org.eclipse.jetty.io.EndPoint.tryFillInterested.

Doc from org.eclipse.jetty.io.EndPoint.tryFillInterested.

Requests callback methods to be invoked when a call to fill(ByteBuffer) would return data or EOF.

Parameters
callback:Callback

the callback to call when an error occurs or we are readable. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.

Returns:boolean

true if set

Annotations
@Override
upgradeback to summary
public void upgrade(Connection newConnection)

Implements org.eclipse.jetty.io.EndPoint.upgrade.

Doc from org.eclipse.jetty.io.EndPoint.upgrade.

Upgrades 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.UpgradeFrom then 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 of Connection.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.

Parameters
newConnection:Connection

the connection to upgrade to

Annotations
@Override
writeback to summary
public void write(Callback callback, ByteBuffer... buffers) throws WritePendingException

Overrides default org.eclipse.jetty.io.EndPoint.write.

Doc from org.eclipse.jetty.io.EndPoint.write.

Writes the given buffers via flush(ByteBuffer...) and invokes callback methods when either all the data has been flushed or an error occurs.

Parameters
callback:Callback

the callback to call when an error occurs or the write completed. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.

buffers:ByteBuffer[]

one or more ByteBuffers that will be flushed.

Annotations
@Override
Exceptions
WritePendingException:
if another write operation is concurrent.
org.eclipse.jetty.io back to summary

private final Enum AbstractEndPoint.State

extends Enum<AbstractEndPoint.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final AbstractEndPoint.State
public static final AbstractEndPoint.State
public static final AbstractEndPoint.State
public static final AbstractEndPoint.State
public static final AbstractEndPoint.State
public static final AbstractEndPoint.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static AbstractEndPoint.State
public static AbstractEndPoint.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CLOSEDback to summary
public static final AbstractEndPoint.State CLOSED
ISHUTback to summary
public static final AbstractEndPoint.State ISHUT
ISHUTTINGback to summary
public static final AbstractEndPoint.State ISHUTTING
OPENback to summary
public static final AbstractEndPoint.State OPEN
OSHUTback to summary
public static final AbstractEndPoint.State OSHUT
OSHUTTINGback to summary
public static final AbstractEndPoint.State OSHUTTING

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static AbstractEndPoint.State valueOf(String name)
valuesback to summary
public static AbstractEndPoint.State[] values()