org.jppf.server.nio
Class SelectionKeyWrapper

java.lang.Object
  extended by org.jppf.utils.ThreadSynchronization
      extended by org.jppf.server.nio.AbstractChannelWrapper<SelectionKey>
          extended by org.jppf.server.nio.SelectionKeyWrapper
All Implemented Interfaces:
ChannelWrapper<SelectionKey>

public class SelectionKeyWrapper
extends AbstractChannelWrapper<SelectionKey>

Channel wrapper implementation for a SelectionKey.

Author:
Laurent Cohen

Field Summary
 
Fields inherited from class org.jppf.server.nio.AbstractChannelWrapper
channel, id, selector
 
Fields inherited from class org.jppf.utils.ThreadSynchronization
stopped
 
Constructor Summary
SelectionKeyWrapper(SelectionKey channel)
          Initialize this channel wrapper with the specified channel.
 
Method Summary
 void close()
          Close the channel.
 NioContext getContext()
          Get the AbstractNioContext attached to the channel.
 String getId()
          Get a string uniquely identifying this channel.
 int getKeyOps()
          Get the operations enabled for this channel.
 int getReadyOps()
          Get the operations available for this channel.
 boolean isOpen()
          Determine whether the channel is opened.
 void setKeyOps(int keyOps)
          Get the operations enabled for this channel.
 String toString()
          Generate a string that represents this channel wrapper.
 
Methods inherited from class org.jppf.server.nio.AbstractChannelWrapper
equals, getChannel, getSelector, hashCode, isAcceptable, isConnectable, isReadable, isWritable, setSelector
 
Methods inherited from class org.jppf.utils.ThreadSynchronization
goToSleep, goToSleep, goToSleep, isStopped, setStopped, wakeUp
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SelectionKeyWrapper

public SelectionKeyWrapper(SelectionKey channel)
Initialize this channel wrapper with the specified channel.

Parameters:
channel - the channel to wrap.
Method Detail

getContext

public NioContext getContext()
Get the AbstractNioContext attached to the channel.

Specified by:
getContext in interface ChannelWrapper<SelectionKey>
Specified by:
getContext in class AbstractChannelWrapper<SelectionKey>
Returns:
a AbstractNioContext instance.
See Also:
AbstractChannelWrapper.getContext()

close

public void close()
           throws Exception
Close the channel.

Specified by:
close in interface ChannelWrapper<SelectionKey>
Overrides:
close in class AbstractChannelWrapper<SelectionKey>
Throws:
Exception - if any error occurs while closing the channel.
See Also:
ChannelWrapper.close()

isOpen

public boolean isOpen()
Determine whether the channel is opened.

Specified by:
isOpen in interface ChannelWrapper<SelectionKey>
Overrides:
isOpen in class AbstractChannelWrapper<SelectionKey>
Returns:
true if the channel is opened, false otherwise.

toString

public String toString()
Generate a string that represents this channel wrapper.

Overrides:
toString in class AbstractChannelWrapper<SelectionKey>
Returns:
a string that represents this channel wrapper.
See Also:
Object.toString()

getId

public String getId()
Get a string uniquely identifying this channel.

Overrides:
getId in class AbstractChannelWrapper<SelectionKey>
Returns:
a unique id as a string.

getKeyOps

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

Specified by:
getKeyOps in interface ChannelWrapper<SelectionKey>
Overrides:
getKeyOps in class AbstractChannelWrapper<SelectionKey>
Returns:
the operations as an int value.
See Also:
AbstractChannelWrapper.getKeyOps()

setKeyOps

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

Specified by:
setKeyOps in interface ChannelWrapper<SelectionKey>
Overrides:
setKeyOps in class AbstractChannelWrapper<SelectionKey>
Parameters:
keyOps - the operations as an int value.
See Also:
AbstractChannelWrapper.setKeyOps(int)

getReadyOps

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

Specified by:
getReadyOps in interface ChannelWrapper<SelectionKey>
Specified by:
getReadyOps in class AbstractChannelWrapper<SelectionKey>
Returns:
the operations as an int value.
See Also:
AbstractChannelWrapper.getReadyOps()


Copyright © 2005-2010 JPPF Team.