Package org.jppf.nio

Interface NioContext

All Superinterfaces:
CloseableContext, NioChannelHandler
All Known Implementing Classes:
AbstractNioContext, AcceptorContext

public interface NioContext extends NioChannelHandler, CloseableContext
Context associated with an open communication channel.
Author:
Laurent Cohen
  • Method Details

    • readMessage

      boolean readMessage() throws Exception
      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

      boolean writeMessage() throws Exception
      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

      void setUuid(String uuid)
      Set the uuid of the node or client for this context.
      Parameters:
      uuid - the uuid as a string.
    • handleException

      void handleException(Exception e)
      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

      void setSSLHandler(SSLHandler sslHandler)
      Get the SSL engine associated with the channel.
      Parameters:
      sslHandler - an instance of SSLHandlerImpl.
    • isSsl

      boolean isSsl()
      Determines whether the connection was opened on an SSL port.
      Returns:
      true for an SSL connection, false otherwise.
    • setSsl

      void setSsl(boolean ssl)
      Specifies whether the connection was opened on an SSL port.
      Parameters:
      ssl - true for an SSL connection, false otherwise.
    • isPeer

      boolean isPeer()
      Determine whether the associated channel is connected to a peer server.
      Returns:
      true if the channel is connected to a peer server, false otherwise.
    • setPeer

      void setPeer(boolean peer)
      Specify whether the associated channel is connected to a peer server.
      Parameters:
      peer - true if the channel is connected to a peer server, false otherwise.
    • isEnabled

      boolean isEnabled()
      Whether this context is enabled.
      Returns:
      true if this context is enabled, false otherwise.
    • setEnabled

      void setEnabled(boolean enabled)
      Enable or disable this context.
      Parameters:
      enabled - true to enable this context, false to disable it.
    • getSocketChannel

      SocketChannel getSocketChannel()
      Get the associated socket chanel, if any.
      Returns:
      a SocketChannel instance, or null if this wrapper has no associated socket chanel.