org.jppf.server.nio
Class AbstractLocalChannelWrapper<S,T extends AbstractNioContext>

java.lang.Object
  extended by org.jppf.utils.ThreadSynchronization
      extended by org.jppf.server.nio.AbstractChannelWrapper<T>
          extended by org.jppf.server.nio.AbstractLocalChannelWrapper<S,T>
Type Parameters:
S - The type of message handled by this channel wrapper.
T - The type of context used by the channel on the server side of the communication.
All Implemented Interfaces:
ChannelWrapper<T>
Direct Known Subclasses:
LocalClassLoaderChannel, LocalNodeChannel

public class AbstractLocalChannelWrapper<S,T extends AbstractNioContext>
extends AbstractChannelWrapper<T>

Channel wrapper and I/O implementation for the class loader of an in-VM node.

Author:
Laurent Cohen

Field Summary
protected  AtomicInteger keyOps
          This channel's key ops.
protected  SimpleObjectLock nodeLock
          Object used to synchronize threads when reading/writing the node message.
protected  S nodeResource
          The resource passed to the node.
protected  AtomicInteger readyOps
          This channel's ready ops.
protected  SimpleObjectLock serverLock
          Object used to synchronize threads when reading/writing the server message.
protected  S serverResource
          The resource passed to the server.
 
Fields inherited from class org.jppf.server.nio.AbstractChannelWrapper
channel, id, selector
 
Fields inherited from class org.jppf.utils.ThreadSynchronization
stopped
 
Constructor Summary
AbstractLocalChannelWrapper(T context)
          Initialize this I/O handler with the specified context.
 
Method Summary
 NioContext getContext()
          Get the AbstractNioContext attached to the channel.
 int getKeyOps()
          Get the operations enabled for this channel.
 SimpleObjectLock getNodeLock()
          Get the object used to synchronize threads when reading/writing the node resource.
 S getNodeResource()
          Get the resource passed to the node.
 int getReadyOps()
          Get the operations available for this channel.
 SimpleObjectLock getServerLock()
          Get the object used to synchronize threads when reading/writing the server resource.
 S getServerResource()
          Get the resource passed to the server.
 void setKeyOps(int keyOps)
          Get the operations enabled for this channel.
 void setNodeResource(S resource)
          Set the resource passed to the node.
 void setReadyOps(int readyOps)
          Set the operations for which this channel is ready.
 void setServerResource(S serverResource)
          Set the resource passed to the server.
 
Methods inherited from class org.jppf.server.nio.AbstractChannelWrapper
close, equals, getChannel, getId, getSelector, hashCode, isAcceptable, isConnectable, isOpen, isReadable, isWritable, setSelector, toString
 
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
 

Field Detail

keyOps

protected AtomicInteger keyOps
This channel's key ops.


readyOps

protected AtomicInteger readyOps
This channel's ready ops.


nodeResource

protected S nodeResource
The resource passed to the node.


serverResource

protected S serverResource
The resource passed to the server.


nodeLock

protected final SimpleObjectLock nodeLock
Object used to synchronize threads when reading/writing the node message.


serverLock

protected final SimpleObjectLock serverLock
Object used to synchronize threads when reading/writing the server message.

Constructor Detail

AbstractLocalChannelWrapper

public AbstractLocalChannelWrapper(T context)
Initialize this I/O handler with the specified context.

Parameters:
context - the context used as communication channel.
Method Detail

getContext

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

Specified by:
getContext in interface ChannelWrapper<T extends AbstractNioContext>
Specified by:
getContext in class AbstractChannelWrapper<T extends AbstractNioContext>
Returns:
a AbstractNioContext instance.

getKeyOps

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

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

setKeyOps

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

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

getReadyOps

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

Specified by:
getReadyOps in interface ChannelWrapper<T extends AbstractNioContext>
Specified by:
getReadyOps in class AbstractChannelWrapper<T extends AbstractNioContext>
Returns:
the operations as an int value.

setReadyOps

public void setReadyOps(int readyOps)
Set the operations for which this channel is ready.

Parameters:
readyOps - the bitwise operations as an int value.

getNodeResource

public S getNodeResource()
Get the resource passed to the node.

Returns:
an instance of the resource type used by this channel.

setNodeResource

public void setNodeResource(S resource)
Set the resource passed to the node.

Parameters:
resource - an instance of the resource type used by this channel.

getServerResource

public S getServerResource()
Get the resource passed to the server.

Returns:
an instance of the resource type used by this channel.

setServerResource

public void setServerResource(S serverResource)
Set the resource passed to the server.

Parameters:
serverResource - an instance of the resource type used by this channel.

getNodeLock

public SimpleObjectLock getNodeLock()
Get the object used to synchronize threads when reading/writing the node resource.

Returns:
a SimpleObjectLock instance.

getServerLock

public SimpleObjectLock getServerLock()
Get the object used to synchronize threads when reading/writing the server resource.

Returns:
a SimpleObjectLock instance.


Copyright © 2005-2010 JPPF Team.