Package org.jppf.nio
Interface NioContext
- All Superinterfaces:
CloseableContext,NioChannelHandler
- All Known Implementing Classes:
AbstractNioContext,AcceptorContext
Context associated with an open communication channel.
- Author:
- Laurent Cohen
-
Method Summary
Modifier and TypeMethodDescriptionGet the associated socket chanel, if any.Get the SSL engine manager associated with the channel.getUuid()Get the uuid of the node or client for this context.voidHandle the cleanup when an exception occurs on the channel.booleanWhether this context is enabled.booleanisPeer()Determine whether the associated channel is connected to a peer server.booleanisSsl()Determines whether the connection was opened on an SSL port.booleanRead data from a channel.voidsetEnabled(boolean enabled) Enable or disable this context.voidsetPeer(boolean peer) Specify whether the associated channel is connected to a peer server.voidsetSsl(boolean ssl) Specifies whether the connection was opened on an SSL port.voidsetSSLHandler(SSLHandler sslHandler) Get the SSL engine associated with the channel.voidSet the uuid of the node or client for this context.booleanWrite data to a channel.Methods inherited from interface org.jppf.nio.CloseableContext
isClosed, setClosedMethods inherited from interface org.jppf.nio.NioChannelHandler
getInterestOps, getSelectionKey, setInterestOps, setSelectionKey
-
Method Details
-
readMessage
Read data from a channel.- Returns:
- true if all the data has been read, false otherwise.
- Throws:
Exception- if an error occurs while reading the data.
-
writeMessage
Write data to a channel.- Returns:
- true if all the data has been written, false otherwise.
- Throws:
Exception- if an error occurs while writing the data.
-
getUuid
String getUuid()Get the uuid of the node or client for this context.- Returns:
- the uuid as a string.
-
setUuid
Set the uuid of the node or client for this context.- Parameters:
uuid- the uuid as a string.
-
handleException
Handle the cleanup when an exception occurs on the channel.- Parameters:
e- exception.
-
getSSLHandler
SSLHandler getSSLHandler()Get the SSL engine manager associated with the channel.- Returns:
- an instance of
SSLHandlerImpl.
-
setSSLHandler
Get the SSL engine associated with the channel.- Parameters:
sslHandler- an instance ofSSLHandlerImpl.
-
isSsl
boolean isSsl()Determines whether the connection was opened on an SSL port.- Returns:
truefor an SSL connection,falseotherwise.
-
setSsl
void setSsl(boolean ssl) Specifies whether the connection was opened on an SSL port.- Parameters:
ssl-truefor an SSL connection,falseotherwise.
-
isPeer
boolean isPeer()Determine whether the associated channel is connected to a peer server.- Returns:
trueif the channel is connected to a peer server,falseotherwise.
-
setPeer
void setPeer(boolean peer) Specify whether the associated channel is connected to a peer server.- Parameters:
peer-trueif the channel is connected to a peer server,falseotherwise.
-
isEnabled
boolean isEnabled()Whether this context is enabled.- Returns:
trueif this context is enabled,falseotherwise.
-
setEnabled
void setEnabled(boolean enabled) Enable or disable this context.- Parameters:
enabled-trueto enable this context,falseto disable it.
-
getSocketChannel
SocketChannel getSocketChannel()Get the associated socket chanel, if any.- Returns:
- a
SocketChannelinstance, or null if this wrapper has no associated socket chanel.
-