org.ow2.petals.transport.platform.nio.selector
Class AbstractSocketChannelContext

java.lang.Object
  extended by org.ow2.petals.transport.platform.nio.selector.AbstractSocketChannelContext
Direct Known Subclasses:
InputSocketChannelContext, OutputSocketChannelContext

public class AbstractSocketChannelContext
extends java.lang.Object

The socket channel context of an input socket. It contains following information:

Author:
Christophe DENEUX (Capgemini Sud)

Field Summary
protected  java.nio.ByteBuffer directBuffer
          NIO Direct buffer containing available bytes of the pending IO.
protected static int INTEGER_SIZE_BYTE
           
protected  boolean isIOPending
          State of the pending IO: true: the buffer contains bytes of a pending IO, false: no byte are reading or writing. It is set to true after to have read or written the externalized message exchange header (its size).
protected  int msgExRemainingBytes
           Remaining bytes to read/write of the externalized message exchange.
protected  java.nio.channels.SocketChannel socketChannel
          The socket channel
 
Constructor Summary
AbstractSocketChannelContext(java.nio.channels.SocketChannel socketChannel, int byteBufferCapacity)
          Create a socket channel context.
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTEGER_SIZE_BYTE

protected static final int INTEGER_SIZE_BYTE
See Also:
Constant Field Values

directBuffer

protected java.nio.ByteBuffer directBuffer
NIO Direct buffer containing available bytes of the pending IO.


isIOPending

protected boolean isIOPending
State of the pending IO: It is set to true after to have read or written the externalized message exchange header (its size). It is set to false after to have read or written the externalized message completely, and to have transmitted the data to an externalized message exchange worker in case of read (to do deserialization and so on).


msgExRemainingBytes

protected int msgExRemainingBytes

Remaining bytes to read/write of the externalized message exchange. It should be initialized with the size of the externalized message exchange size plus the header size.

Note: "Remaining bytes to write" must understand as "Remaining bytes to put in the NIO direct buffer" and not as "Remaining byts to write in the TCP socket"


socketChannel

protected final java.nio.channels.SocketChannel socketChannel
The socket channel

Constructor Detail

AbstractSocketChannelContext

public AbstractSocketChannelContext(java.nio.channels.SocketChannel socketChannel,
                                    int byteBufferCapacity)
Create a socket channel context.

Parameters:
socketChannel -
byteBufferCapacity - Size of the direct buffer to use to read or write bytes.


Copyright © 2005-2011 Petals Link (EBM Websourcing). All Rights Reserved.