Package org.eclipse.jetty.io
Class SelectableChannelEndPoint
- java.lang.Object
-
- org.eclipse.jetty.io.IdleTimeout
-
- org.eclipse.jetty.io.AbstractEndPoint
-
- org.eclipse.jetty.io.SelectableChannelEndPoint
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,EndPoint
,ManagedSelector.Selectable
- Direct Known Subclasses:
DatagramChannelEndPoint
,SocketChannelEndPoint
public abstract class SelectableChannelEndPoint extends AbstractEndPoint implements ManagedSelector.Selectable
A partial
EndPoint
implementation based onSelectableChannel
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.EndPoint
EndPoint.Wrapper
-
-
Constructor Summary
Constructors Constructor Description SelectableChannelEndPoint(Scheduler scheduler, java.nio.channels.SelectableChannel channel, ManagedSelector selector, java.nio.channels.SelectionKey selectionKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doClose()
java.nio.channels.SelectableChannel
getChannel()
java.net.SocketAddress
getLocalSocketAddress()
java.lang.Object
getTransport()
boolean
isOpen()
This abstract method should be called to check if idle timeouts should still be checked.protected void
needsFillInterest()
void
onClose(java.lang.Throwable cause)
Callback method invoked when thisEndPoint
is closed.protected void
onIncompleteFlush()
java.lang.Runnable
onSelected()
Callback method invoked when a read or write events has been detected by theManagedSelector
for this endpoint.void
replaceKey(java.nio.channels.SelectionKey newKey)
Callback method invoked when the SelectionKey is replaced because the channel has been moved to a new selector.java.lang.String
toEndPointString()
void
updateKey()
Callback method invoked when all the keys selected by theManagedSelector
for this endpoint have been processed.-
Methods inherited from class org.eclipse.jetty.io.AbstractEndPoint
close, close, doShutdownInput, doShutdownOutput, fillInterested, getConnection, getCreatedTimeStamp, getFillInterest, getLocalAddress, getRemoteAddress, getRemoteSocketAddress, getWriteFlusher, isFillInterested, isInputShutdown, isOutputShutdown, onClose, onIdleExpired, onOpen, reset, setConnection, shutdownInput, shutdownOutput, toConnectionString, toString, tryFillInterested, upgrade, write
-
Methods inherited from class org.eclipse.jetty.io.IdleTimeout
checkIdleTimeout, getIdleFor, getIdleTimeout, getScheduler, notIdle, setIdleTimeout
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.io.EndPoint
fill, flush, getIdleTimeout, setIdleTimeout
-
-
-
-
Constructor Detail
-
SelectableChannelEndPoint
public SelectableChannelEndPoint(Scheduler scheduler, java.nio.channels.SelectableChannel channel, ManagedSelector selector, java.nio.channels.SelectionKey selectionKey)
-
-
Method Detail
-
getChannel
public java.nio.channels.SelectableChannel getChannel()
-
getTransport
public java.lang.Object getTransport()
- Specified by:
getTransport
in interfaceEndPoint
- Returns:
- The underlying transport object (socket, channel, etc.)
-
getLocalSocketAddress
public java.net.SocketAddress getLocalSocketAddress()
- Specified by:
getLocalSocketAddress
in interfaceEndPoint
- Overrides:
getLocalSocketAddress
in classAbstractEndPoint
- Returns:
- the local SocketAddress to which this
EndPoint
is bound ornull
if thisEndPoint
is not bound to a Socket address.
-
isOpen
public boolean isOpen()
Description copied from class:IdleTimeout
This abstract method should be called to check if idle timeouts should still be checked.- Specified by:
isOpen
in interfaceEndPoint
- Overrides:
isOpen
in classAbstractEndPoint
- Returns:
- True if the entity monitored should still be checked for idle timeouts
-
doClose
public void doClose()
- Overrides:
doClose
in classAbstractEndPoint
-
onClose
public void onClose(java.lang.Throwable cause)
Description copied from interface:EndPoint
Callback method invoked when this
EndPoint
is closed.- Specified by:
onClose
in interfaceEndPoint
- Overrides:
onClose
in classAbstractEndPoint
- Parameters:
cause
- The reason for the close, or null if a normal close.- See Also:
EndPoint.onOpen()
-
needsFillInterest
protected void needsFillInterest()
- Specified by:
needsFillInterest
in classAbstractEndPoint
-
onIncompleteFlush
protected void onIncompleteFlush()
- Specified by:
onIncompleteFlush
in classAbstractEndPoint
-
onSelected
public java.lang.Runnable onSelected()
Description copied from interface:ManagedSelector.Selectable
Callback method invoked when a read or write events has been detected by theManagedSelector
for this endpoint.- Specified by:
onSelected
in interfaceManagedSelector.Selectable
- Returns:
- a job that may block or null
-
updateKey
public void updateKey()
Description copied from interface:ManagedSelector.Selectable
Callback method invoked when all the keys selected by theManagedSelector
for this endpoint have been processed.- Specified by:
updateKey
in interfaceManagedSelector.Selectable
-
replaceKey
public void replaceKey(java.nio.channels.SelectionKey newKey)
Description copied from interface:ManagedSelector.Selectable
Callback method invoked when the SelectionKey is replaced because the channel has been moved to a new selector.- Specified by:
replaceKey
in interfaceManagedSelector.Selectable
- Parameters:
newKey
- the new SelectionKey
-
toEndPointString
public java.lang.String toEndPointString()
- Overrides:
toEndPointString
in classAbstractEndPoint
-
-