org.apache.catalina.tribes.transport.nio
public class NioSender extends AbstractSender implements DataSender
Modifier and Type | Field and Description |
---|---|
protected XByteBuffer |
ackbuf |
protected boolean |
complete |
protected boolean |
connecting |
protected byte[] |
current |
protected static Log |
log |
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 and Description |
---|
NioSender() |
Modifier and Type | Method and Description |
---|---|
void |
connect()
connect - blocking in this operation
|
void |
disconnect()
disconnect
|
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) |
getAddress, getAttempt, getConnectTime, getDestination, getDirect, getDirectBuffer, getKeepAliveCount, getKeepAliveTime, getMaxRetryAttempts, getOoBInline, getPort, getRequestCount, getRxBufSize, getSoKeepAlive, getSoLingerOn, getSoLingerTime, getSoReuseAddress, getSoTrafficClass, getTcpNoDelay, getThrowOnFailedAck, getTimeout, getTxBufSize, isConnected, keepalive, setAddress, setAttempt, setConnected, setConnectTime, setDestination, setDirect, setDirectBuffer, setKeepAliveCount, setKeepAliveTime, setMaxRetryAttempts, setOoBInline, setPort, setRequestCount, setRxBufSize, setSoKeepAlive, setSoLingerOn, setSoLingerTime, setSoReuseAddress, setSoTrafficClass, setTcpNoDelay, setThrowOnFailedAck, setTimeout, setTxBufSize, transferProperties
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConnectTime, getRequestCount, isConnected, keepalive, setKeepAliveCount, setKeepAliveTime, setRxBufSize, setTimeout, setTxBufSize
protected static Log log
protected java.nio.channels.Selector selector
protected java.nio.channels.SocketChannel socketChannel
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
public boolean process(java.nio.channels.SelectionKey key, boolean waitForAck) throws java.io.IOException
key
- SelectionKeyjava.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 DataSender
connect
in class AbstractSender
java.io.IOException
public void disconnect()
disconnect
in interface DataSender
disconnect
in class AbstractSender
public void reset()
public void setMessage(byte[] data) throws java.io.IOException
data
- ChannelMessagejava.io.IOException
public void setMessage(byte[] data, int offset, int length) throws java.io.IOException
java.io.IOException
public byte[] getMessage()
public boolean isComplete()
public java.nio.channels.Selector getSelector()
public void setSelector(java.nio.channels.Selector selector)
public void setComplete(boolean complete)
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.