public class TCPConnectionMap.TCPConnection extends Object implements Connection
Modifier and Type | Class and Description |
---|---|
protected class |
TCPConnectionMap.TCPConnection.Receiver |
protected class |
TCPConnectionMap.TCPConnection.Sender |
Modifier and Type | Field and Description |
---|---|
protected byte[] |
cookie |
protected DataInputStream |
in |
protected long |
last_access |
protected DataOutputStream |
out |
protected Address |
peer_addr |
protected TCPConnectionMap.TCPConnection.Receiver |
receiver |
protected Lock |
send_lock |
protected TCPConnectionMap.TCPConnection.Sender |
sender |
protected Socket |
sock |
Constructor and Description |
---|
TCPConnection(Address peer_addr)
Creates a connection stub and binds it, use
connect(java.net.SocketAddress) to connect |
TCPConnection(Socket s) |
Modifier and Type | Method and Description |
---|---|
protected void |
_send(byte[] data,
int offset,
int length,
boolean acquire_lock)
Sends data using the 'out' output stream of the socket
|
void |
close() |
protected void |
connect(SocketAddress destAddr)
Called after
TCPConnection#TCPConnection(org.jgroups.Address) |
protected void |
doSend(byte[] data,
int offset,
int length) |
protected Address |
getPeerAddress() |
protected String |
getSockAddress() |
boolean |
isConnected() |
boolean |
isExpired(long now) |
boolean |
isOpen() |
protected boolean |
isSenderUsed() |
protected boolean |
matchCookie(byte[] input) |
protected Address |
readPeerAddress(Socket client_sock)
Reads the peer's address.
|
protected void |
send(byte[] data,
int offset,
int length) |
protected void |
sendLocalAddress(Address local_addr)
Send the cookie first, then the our port number.
|
protected TCPConnectionMap.TCPConnection |
start(ThreadFactory f) |
String |
toString() |
protected void |
updateLastAccessed() |
protected final Socket sock
protected final Lock send_lock
protected final byte[] cookie
protected DataOutputStream out
protected DataInputStream in
protected Address peer_addr
protected long last_access
protected TCPConnectionMap.TCPConnection.Sender sender
protected TCPConnectionMap.TCPConnection.Receiver receiver
public TCPConnection(Address peer_addr) throws Exception
connect(java.net.SocketAddress)
to connectException
protected Address getPeerAddress()
protected boolean isSenderUsed()
protected String getSockAddress()
protected void updateLastAccessed()
protected void connect(SocketAddress destAddr) throws Exception
TCPConnection#TCPConnection(org.jgroups.Address)
Exception
protected TCPConnectionMap.TCPConnection start(ThreadFactory f)
protected void send(byte[] data, int offset, int length) throws Exception
data
- Guaranteed to be non nulloffset
- length
- Exception
protected void _send(byte[] data, int offset, int length, boolean acquire_lock) throws Exception
data
- offset
- length
- acquire_lock
- Exception
protected void doSend(byte[] data, int offset, int length) throws Exception
Exception
protected Address readPeerAddress(Socket client_sock) throws Exception
Exception
protected void sendLocalAddress(Address local_addr) throws Exception
Exception
protected boolean matchCookie(byte[] input)
public boolean isExpired(long now)
isExpired
in interface Connection
public boolean isConnected()
public boolean isOpen()
isOpen
in interface Connection
public void close() throws IOException
close
in interface Connection
IOException
Copyright © 2016 JBoss, a division of Red Hat. All rights reserved.