public class NioConnection extends Connection
Connection| Modifier and Type | Class and Description |
|---|---|
protected class |
NioConnection.Reader |
protected static class |
NioConnection.State |
| Modifier and Type | Field and Description |
|---|---|
protected SocketChannel |
channel |
protected boolean |
copy_on_partial_write |
protected SelectionKey |
key |
protected int |
partial_writes |
protected NioConnection.Reader |
reader |
protected long |
reader_idle_time |
protected Buffers |
recv_buf |
protected Buffers |
send_buf |
protected Lock |
send_lock |
protected NioBaseServer |
server |
protected boolean |
write_interest_set |
cookie, last_access, peer_addr| Constructor and Description |
|---|
NioConnection(Address peer_addr,
NioBaseServer server)
Creates a connection stub and binds it, use
connect(Address) to connect |
NioConnection(SocketChannel channel,
NioBaseServer server) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
_receive(boolean update) |
void |
clearSelectionKey(int interest_ops) |
void |
close() |
void |
connect(Address dest) |
protected void |
connect(Address dest,
boolean send_local_addr) |
boolean |
copyOnPartialWrite() |
NioConnection |
copyOnPartialWrite(boolean b) |
protected static byte[] |
getBuffer(ByteBuffer buf) |
protected long |
getTimestamp() |
boolean |
isConnected() |
boolean |
isExpired(long now) |
boolean |
isOpen() |
SelectionKey |
key() |
NioConnection |
key(SelectionKey k) |
Address |
localAddress() |
protected static ByteBuffer |
makeLengthBuffer(ByteBuffer buf) |
int |
numPartialWrites() |
Address |
peerAddress() |
long |
readerIdleTime() |
NioConnection |
readerIdleTime(long t) |
boolean |
readerRunning() |
protected Address |
readPeerAddress() |
void |
receive()
Read the length first, then the actual data.
|
void |
registerSelectionKey(int interest_ops) |
void |
send() |
void |
send(byte[] buf,
int offset,
int length) |
void |
send(ByteBuffer buf)
Sends a message.
|
protected void |
send(ByteBuffer buf,
boolean send_length) |
protected void |
sendLocalAddress(Address local_addr) |
protected void |
setSocketParameters(Socket client_sock) |
void |
start() |
protected String |
status() |
String |
toString() |
protected void |
updateLastAccessed() |
protected void |
writeInterest(boolean register) |
protected SocketChannel channel
protected SelectionKey key
protected final NioBaseServer server
protected final Buffers send_buf
protected boolean write_interest_set
protected boolean copy_on_partial_write
protected int partial_writes
protected final Lock send_lock
protected Buffers recv_buf
protected NioConnection.Reader reader
protected long reader_idle_time
public NioConnection(Address peer_addr, NioBaseServer server) throws Exception
connect(Address) to connectExceptionpublic NioConnection(SocketChannel channel, NioBaseServer server) throws Exception
Exceptionpublic boolean isOpen()
isOpen in class Connectionpublic boolean isConnected()
isConnected in class Connectionpublic boolean isExpired(long now)
isExpired in class Connectionprotected void updateLastAccessed()
public Address localAddress()
localAddress in class Connectionpublic Address peerAddress()
peerAddress in class Connectionpublic SelectionKey key()
public NioConnection key(SelectionKey k)
public NioConnection copyOnPartialWrite(boolean b)
public boolean copyOnPartialWrite()
public int numPartialWrites()
public long readerIdleTime()
public NioConnection readerIdleTime(long t)
public boolean readerRunning()
public void registerSelectionKey(int interest_ops)
public void clearSelectionKey(int interest_ops)
public void connect(Address dest) throws Exception
connect in class ConnectionExceptionprotected void connect(Address dest, boolean send_local_addr) throws Exception
Exceptionpublic void start()
throws Exception
start in class ConnectionExceptionpublic void send(byte[] buf,
int offset,
int length)
throws Exception
send in class ConnectionExceptionpublic void send(ByteBuffer buf) throws Exception
send in class Connectionbuf - Exceptionpublic void receive()
throws Exception
Exceptionprotected void send(ByteBuffer buf, boolean send_length) throws Exception
Exceptionpublic void close()
throws IOException
IOExceptionprotected String status()
protected long getTimestamp()
protected void writeInterest(boolean register)
protected void setSocketParameters(Socket client_sock) throws SocketException
SocketExceptionprotected void sendLocalAddress(Address local_addr) throws Exception
Exceptionprotected static byte[] getBuffer(ByteBuffer buf)
protected static ByteBuffer makeLengthBuffer(ByteBuffer buf)
Copyright © 2025 JBoss, a division of Red Hat. All rights reserved.