|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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 java.nio.channels.DatagramChannel |
dataChannel
|
protected java.nio.ByteBuffer |
readbuf
|
protected int |
remaining
|
protected java.nio.channels.Selector |
selector
|
protected java.nio.channels.SocketChannel |
socketChannel
|
protected java.nio.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()
|
java.nio.channels.Selector |
getSelector()
|
boolean |
isComplete()
|
boolean |
process(java.nio.channels.SelectionKey key,
boolean waitForAck)
State machine to send data |
protected boolean |
read(java.nio.channels.SelectionKey key)
|
void |
reset()
|
void |
setComplete(boolean complete)
|
void |
setMessage(byte[] data)
sendMessage |
void |
setMessage(byte[] data,
int offset,
int length)
|
void |
setSelector(java.nio.channels.Selector selector)
|
protected boolean |
write(java.nio.channels.SelectionKey key)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.nio.channels.Selector selector
protected java.nio.channels.SocketChannel socketChannel
protected java.nio.channels.DatagramChannel dataChannel
protected java.nio.ByteBuffer readbuf
protected java.nio.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(java.nio.channels.SelectionKey key,
boolean waitForAck)
throws java.io.IOException
key - SelectionKey
java.io.IOException
protected boolean read(java.nio.channels.SelectionKey key)
throws java.io.IOException
java.io.IOException
protected boolean write(java.nio.channels.SelectionKey key)
throws java.io.IOException
java.io.IOException
public void connect()
throws java.io.IOException
connect in interface DataSenderconnect in class AbstractSenderjava.io.IOException - TODO Implement this org.apache.catalina.tribes.transport.IDataSender methodpublic void disconnect()
disconnect in interface DataSenderdisconnect in class AbstractSenderpublic void reset()
public void setMessage(byte[] data)
throws java.io.IOException
data - ChannelMessage
java.io.IOException - TODO Implement this org.apache.catalina.tribes.transport.IDataSender method
public void setMessage(byte[] data,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionpublic byte[] getMessage()
public boolean isComplete()
public java.nio.channels.Selector getSelector()
public void setSelector(java.nio.channels.Selector selector)
public void setComplete(boolean complete)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||