org.jppf.server.nio
Interface NioContext<S extends Enum<S>>

Type Parameters:
S - the type of states associated with this context.
All Known Implementing Classes:
AbstractNioContext, AbstractNodeContext, ClassContext, LocalClassContext, LocalNodeContext, MultiplexerContext, MultiplexerContext, RemoteNodeContext, SimpleNioContext

public interface NioContext<S extends Enum<S>>

Context associated with an open communication channel.

Author:
Laurent Cohen

Method Summary
 ChannelWrapper<?> getChannel()
          Get the associated channel.
 S getState()
          Get the current state of the channel this context is associated with.
 String getUuid()
          Get the uuid for this node context.
 void handleException(ChannelWrapper<?> channel)
          Handle the cleanup when an exception occurs on the channel.
 boolean readMessage(ChannelWrapper<?> wrapper)
          Read data from a channel.
 void setChannel(ChannelWrapper<?> channel)
          Set the associated channel.
 void setState(S state)
          Set the current state of the channel this context is associated with.
 void setUuid(String uuid)
          Set the uuid for this node context.
 boolean writeMessage(ChannelWrapper<?> wrapper)
          Write data to a channel.
 

Method Detail

getState

S getState()
Get the current state of the channel this context is associated with.

Returns:
a state enum value.

setState

void setState(S state)
Set the current state of the channel this context is associated with.

Parameters:
state - a state enum value.

readMessage

boolean readMessage(ChannelWrapper<?> wrapper)
                    throws Exception
Read data from a channel.

Parameters:
wrapper - the channel to read the data from.
Returns:
true if all the data has been read, false otherwise.
Throws:
Exception - if an error occurs while reading the data.

writeMessage

boolean writeMessage(ChannelWrapper<?> wrapper)
                     throws Exception
Write data to a channel.

Parameters:
wrapper - the channel to write the data to.
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 for this node context.

Returns:
the uuid as a string.

setUuid

void setUuid(String uuid)
Set the uuid for this node context.

Parameters:
uuid - the uuid as a string.

handleException

void handleException(ChannelWrapper<?> channel)
Handle the cleanup when an exception occurs on the channel.

Parameters:
channel - the channel that threw the exception.

getChannel

ChannelWrapper<?> getChannel()
Get the associated channel.

Returns:
a ChannelWrapper instance.

setChannel

void setChannel(ChannelWrapper<?> channel)
Set the associated channel.

Parameters:
channel - a ChannelWrapper instance.


Copyright © 2005-2010 JPPF Team.