org.jppf.server.nio
Interface ChannelWrapper<S>

Type Parameters:
S -
All Known Implementing Classes:
AbstractChannelWrapper, AbstractLocalChannelWrapper, LocalClassLoaderChannel, LocalNodeChannel, SelectionKeyWrapper

public interface ChannelWrapper<S>

Interface for a set of abstractions wrapping different communication channels into a common semantic.

Author:
Laurent Cohen

Method Summary
 void close()
          Close the channel.
 S getChannel()
          Get the channel to wrap.
 NioContext<?> getContext()
          Get the AbstractNioContext attached to the channel.
 int getKeyOps()
          Get the operations enabled for this channel.
 int getReadyOps()
          Get the operations available for this channel.
 ChannelSelector getSelector()
          Get the selector associated with this channel.
 boolean isAcceptable()
          Determine whether the channel can accept connections.
 boolean isConnectable()
          Determine whether the channel can be connected.
 boolean isOpen()
          Determine whether the channel is opened.
 boolean isReadable()
          Determine whether the channel can be read from.
 boolean isWritable()
          Determine whether the channel can be written to.
 void setKeyOps(int keyOps)
          Get the operations enabled for this channel.
 void setSelector(ChannelSelector selector)
          Set the selector associated with this channel.
 

Method Detail

getChannel

S getChannel()
Get the channel to wrap.

Returns:
the wrapped channel.

close

void close()
           throws Exception
Close the channel.

Throws:
Exception - if any error occurs while closing the channel.

getContext

NioContext<?> getContext()
Get the AbstractNioContext attached to the channel.

Returns:
a AbstractNioContext instance.

isOpen

boolean isOpen()
Determine whether the channel is opened.

Returns:
true if the channel is opened, false otherwise.

getKeyOps

int getKeyOps()
Get the operations enabled for this channel.

Returns:
the operations as an int value.

setKeyOps

void setKeyOps(int keyOps)
Get the operations enabled for this channel.

Parameters:
keyOps - the operations as an int value.

getReadyOps

int getReadyOps()
Get the operations available for this channel.

Returns:
the operations as an int value.

isReadable

boolean isReadable()
Determine whether the channel can be read from.

Returns:
true if the channel can be read, false otherwise.

isWritable

boolean isWritable()
Determine whether the channel can be written to.

Returns:
true if the channel can be written to, false otherwise.

isAcceptable

boolean isAcceptable()
Determine whether the channel can accept connections.

Returns:
true if the channel can accept connections, false otherwise.

isConnectable

boolean isConnectable()
Determine whether the channel can be connected.

Returns:
true if the channel can be connected, false otherwise.

getSelector

ChannelSelector getSelector()
Get the selector associated with this channel.

Returns:
a LocalChannelSelector instance.

setSelector

void setSelector(ChannelSelector selector)
Set the selector associated with this channel.

Parameters:
selector - a LocalChannelSelector instance.


Copyright © 2005-2010 JPPF Team.