public class TCPConnectionMap.TCPConnection extends java.lang.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 java.io.DataInputStream |
in |
protected long |
last_access |
protected java.io.DataOutputStream |
out |
protected Address |
peer_addr |
protected TCPConnectionMap.TCPConnection.Receiver |
receiver |
protected java.util.concurrent.locks.ReentrantLock |
send_lock |
protected TCPConnectionMap.TCPConnection.Sender |
sender |
protected java.net.Socket |
sock |
Constructor and Description |
---|
TCPConnection(Address peer_addr)
Creates a connection stub and binds it, use
connect(java.net.SocketAddress) to connect |
TCPConnection(java.net.Socket s) |
Modifier and Type | Method and Description |
---|---|
protected void |
_send(byte[] data,
int offset,
int length,
boolean acquire_lock,
boolean flush)
Sends data using the 'out' output stream of the socket
|
void |
close() |
protected void |
connect(java.net.SocketAddress destAddr)
Called after
TCPConnection#TCPConnection(org.jgroups.Address) |
protected void |
doSend(byte[] data,
int offset,
int length,
boolean acquire_lock,
boolean flush) |
protected void |
flush() |
protected Address |
getPeerAddress() |
protected java.lang.String |
getSockAddress() |
protected long |
getTimestamp() |
boolean |
isConnected() |
boolean |
isExpired(long now) |
boolean |
isOpen() |
protected boolean |
isSenderUsed() |
protected boolean |
matchCookie(byte[] input) |
protected Address |
readPeerAddress(java.net.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) |
java.lang.String |
toString() |
protected void |
updateLastAccessed() |
protected final java.net.Socket sock
protected final java.util.concurrent.locks.ReentrantLock send_lock
protected final byte[] cookie
protected java.io.DataOutputStream out
protected java.io.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 java.lang.Exception
connect(java.net.SocketAddress)
to connectjava.lang.Exception
public TCPConnection(java.net.Socket s) throws java.lang.Exception
java.lang.Exception
protected long getTimestamp()
protected Address getPeerAddress()
protected boolean isSenderUsed()
protected java.lang.String getSockAddress()
protected void updateLastAccessed()
protected void connect(java.net.SocketAddress destAddr) throws java.lang.Exception
TCPConnection#TCPConnection(org.jgroups.Address)
java.lang.Exception
protected TCPConnectionMap.TCPConnection start(ThreadFactory f)
protected void send(byte[] data, int offset, int length) throws java.lang.Exception
data
- Guaranteed to be non nulloffset
- length
- java.lang.Exception
protected void _send(byte[] data, int offset, int length, boolean acquire_lock, boolean flush) throws java.lang.Exception
data
- offset
- length
- acquire_lock
- java.lang.Exception
protected void doSend(byte[] data, int offset, int length, boolean acquire_lock, boolean flush) throws java.lang.Exception
java.lang.Exception
protected void flush() throws java.lang.Exception
java.lang.Exception
protected Address readPeerAddress(java.net.Socket client_sock) throws java.lang.Exception
java.lang.Exception
protected void sendLocalAddress(Address local_addr) throws java.lang.Exception
java.lang.Exception
protected boolean matchCookie(byte[] input)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isExpired(long now)
isExpired
in interface Connection
public boolean isConnected()
public boolean isOpen()
isOpen
in interface Connection
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface Connection
java.io.IOException
Copyright © 1998-2020 Red Hat. All Rights Reserved.