org.jppf.server.nio.multiplexer
Class MultiplexerContext

java.lang.Object
  extended by org.jppf.server.nio.AbstractNioContext<S>
      extended by org.jppf.server.nio.SimpleNioContext<MultiplexerState>
          extended by org.jppf.server.nio.multiplexer.MultiplexerContext
All Implemented Interfaces:
NioContext<MultiplexerState>

public class MultiplexerContext
extends SimpleNioContext<MultiplexerState>

Context obect associated with a socket channel used by the multiplexer.

Author:
Laurent Cohen

Field Summary
 
Fields inherited from class org.jppf.server.nio.AbstractNioContext
connectionUuid, message, readByteCount, state, uuid, writeByteCount
 
Constructor Summary
MultiplexerContext()
           
 
Method Summary
 int getBoundPort()
          Get the application port to which the channel may be bound.
 ChannelWrapper<?> getLinkedKey()
          Get the request currently processed.
 int getMultiplexerPort()
          Get the multiplexer port to which the channel may be bound.
 void handleException(ChannelWrapper<?> channel)
          Handle the cleanup when an exception occurs on the channel.
 boolean isApplicationPort()
          Determine whether the associated channel is connected to an application port.
 boolean isMultiplexerPort()
          Determine whether the associated channel is connected to a multiplexer port.
 int readOutBoundPort()
          Get the port outbound port number for this channel, sent as the initial message.
 void setBoundPort(int boundPort)
          Set the application port to which the channel may be bound.
 void setLinkedKey(ChannelWrapper<?> key)
          Set the request currently processed.
 void setMultiplexerPort(int multiplexerPort)
          Set the multiplexer port to which the channel may be bound.
 
Methods inherited from class org.jppf.server.nio.SimpleNioContext
readMessage, writeMessage
 
Methods inherited from class org.jppf.server.nio.AbstractNioContext
getChannel, getConnectionUuid, getMessage, getShortClassName, getState, getUuid, setChannel, setConnectionUuid, setMessage, setState, setUuid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiplexerContext

public MultiplexerContext()
Method Detail

handleException

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

Parameters:
channel - the channel that threw the exception.

getLinkedKey

public ChannelWrapper<?> getLinkedKey()
Get the request currently processed.

Returns:
a ChannelWrapper instance.

setLinkedKey

public void setLinkedKey(ChannelWrapper<?> key)
Set the request currently processed.

Parameters:
key - a ChannelWrapper instance.

getBoundPort

public int getBoundPort()
Get the application port to which the channel may be bound.

Returns:
the port as an int value, or a negative value if the channel is not bound to an application port.

setBoundPort

public void setBoundPort(int boundPort)
Set the application port to which the channel may be bound.

Parameters:
boundPort - the port as an int value, or a negative value if the channel is not bound to an application port.

getMultiplexerPort

public int getMultiplexerPort()
Get the multiplexer port to which the channel may be bound.

Returns:
the port as an int value, or a negative value if the channel is not bound to a multiplexer port.

setMultiplexerPort

public void setMultiplexerPort(int multiplexerPort)
Set the multiplexer port to which the channel may be bound.

Parameters:
multiplexerPort - the port as an int value, or a negative value if the channel is not bound to a multiplexer port.

isApplicationPort

public boolean isApplicationPort()
Determine whether the associated channel is connected to an application port.

Returns:
true if the channel is bound to an application port, false otherwise.

isMultiplexerPort

public boolean isMultiplexerPort()
Determine whether the associated channel is connected to a multiplexer port.

Returns:
true if the channel is bound to a multiplexer port, false otherwise.

readOutBoundPort

public int readOutBoundPort()
Get the port outbound port number for this channel, sent as the initial message.

Returns:
the port number as an int, or -1 if it could not be read.


Copyright © 2005-2010 JPPF Team.