|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.catalina.tribes.transport.AbstractSender org.apache.catalina.tribes.transport.nio.NioSender
public class NioSender
This class is NOT thread safe and should never be used with more than one thread at a time This is a state machine, handled by the process method States are: - NOT_CONNECTED -> connect() -> CONNECTED - CONNECTED -> setMessage() -> READY TO WRITE - READY_TO_WRITE -> write() -> READY TO WRITE | READY TO READ - READY_TO_READ -> read() -> READY_TO_READ | TRANSFER_COMPLETE - TRANSFER_COMPLETE -> CONNECTED
Field Summary | |
---|---|
protected XByteBuffer |
ackbuf
|
protected boolean |
complete
|
protected boolean |
connecting
|
protected byte[] |
current
|
protected DatagramChannel |
dataChannel
|
protected ByteBuffer |
readbuf
|
protected int |
remaining
|
protected Selector |
selector
|
protected SocketChannel |
socketChannel
|
protected ByteBuffer |
writebuf
|
Constructor Summary | |
---|---|
NioSender()
|
Method Summary | |
---|---|
void |
connect()
connect - blocking in this operation |
void |
disconnect()
disconnect TODO Implement this org.apache.catalina.tribes.transport.IDataSender method |
byte[] |
getMessage()
|
Selector |
getSelector()
|
boolean |
isComplete()
|
boolean |
process(SelectionKey key,
boolean waitForAck)
State machine to send data |
protected boolean |
read(SelectionKey key)
|
void |
reset()
|
void |
setComplete(boolean complete)
|
void |
setMessage(byte[] data)
sendMessage |
void |
setMessage(byte[] data,
int offset,
int length)
|
void |
setSelector(Selector selector)
|
protected boolean |
write(SelectionKey key)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Selector selector
protected SocketChannel socketChannel
protected DatagramChannel dataChannel
protected ByteBuffer readbuf
protected ByteBuffer writebuf
protected byte[] current
protected XByteBuffer ackbuf
protected int remaining
protected boolean complete
protected boolean connecting
Constructor Detail |
---|
public NioSender()
Method Detail |
---|
public boolean process(SelectionKey key, boolean waitForAck) throws IOException
key
- SelectionKey
IOException
protected boolean read(SelectionKey key) throws IOException
IOException
protected boolean write(SelectionKey key) throws IOException
IOException
public void connect() throws IOException
connect
in interface DataSender
connect
in class AbstractSender
IOException
- TODO Implement this org.apache.catalina.tribes.transport.IDataSender methodpublic void disconnect()
disconnect
in interface DataSender
disconnect
in class AbstractSender
public void reset()
public void setMessage(byte[] data) throws IOException
data
- ChannelMessage
IOException
- TODO Implement this org.apache.catalina.tribes.transport.IDataSender methodpublic void setMessage(byte[] data, int offset, int length) throws IOException
IOException
public byte[] getMessage()
public boolean isComplete()
public Selector getSelector()
public void setSelector(Selector selector)
public void setComplete(boolean complete)
|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |