Package com.sshtools.synergy.nio
Interface SocketHandler
- All Superinterfaces:
SelectionKeyAware,SelectorRegistrationListener
- All Known Implementing Classes:
LocalForwardingChannel,RemoteForwardingChannel,SocketConnection,SocketForwardingChannel,SSLContextConnection,SSLSocketConnection
An interface used by the
SelectorThread to notify an object
of when a read or write event has occurred.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddTask(ConnectionAwareTask task) Add a task to the executorConnection<? extends SshContext>Get the Connection for this handlerGet the current contextintReturns the current operations the handler is interested ingetName()A name for this SocketGet the selector thread this handler is connected to.voidinitialize(ProtocolEngine engine, SshEngine daemon, SelectableChannel channel) Initialise this socket with aProtocolEngineand the currentSshEngine.booleanThe selector is ready to be read.booleanThe selector is ready to be written to.voidsetThread(SelectorThread thread) Sets the selector thread this handler runs uponbooleanTell the selector that the handler wants to read.booleanTell the selector that the handler wants to write.Methods inherited from interface com.sshtools.synergy.nio.SelectionKeyAware
setSelectionKeyMethods inherited from interface com.sshtools.synergy.nio.SelectorRegistrationListener
registrationCompleted
-
Method Details
-
initialize
void initialize(ProtocolEngine engine, SshEngine daemon, SelectableChannel channel) throws IOException Initialise this socket with aProtocolEngineand the currentSshEngine.- Parameters:
engine- ProtocolEnginedaemon- Daemon- Throws:
IOException
-
processReadEvent
boolean processReadEvent()The selector is ready to be read.- Returns:
- boolean indicating ??
-
processWriteEvent
boolean processWriteEvent()The selector is ready to be written to.- Returns:
- boolean
-
getInitialOps
int getInitialOps()Returns the current operations the handler is interested in- Returns:
- int
-
setThread
Sets the selector thread this handler runs upon- Parameters:
thread-
-
addTask
Add a task to the executor -
wantsWrite
boolean wantsWrite()Tell the selector that the handler wants to write.- Returns:
-
getSelectorThread
SelectorThread getSelectorThread()Get the selector thread this handler is connected to.- Returns:
-
getName
String getName()A name for this Socket- Returns:
-
getContext
SshContext getContext()Get the current context- Returns:
-
getConnection
Connection<? extends SshContext> getConnection()Get the Connection for this handler- Returns:
-
wantsRead
boolean wantsRead()Tell the selector that the handler wants to read.- Returns:
-