org.jgroups.blocks
Class TCPConnectionMap.TCPConnection
java.lang.Object
org.jgroups.blocks.TCPConnectionMap.TCPConnection
- All Implemented Interfaces:
- Connection
- Enclosing class:
- TCPConnectionMap
public class TCPConnectionMap.TCPConnection
- extends java.lang.Object
- implements Connection
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
sock
protected final java.net.Socket sock
send_lock
protected final java.util.concurrent.locks.Lock send_lock
log
protected final Log log
cookie
protected final byte[] cookie
out
protected final java.io.DataOutputStream out
in
protected final java.io.DataInputStream in
peer_addr
protected final Address peer_addr
peer_addr_read_timeout
protected final int peer_addr_read_timeout
- See Also:
- Constant Field Values
last_access
protected long last_access
sender
protected TCPConnectionMap.TCPConnection.Sender sender
connectionPeerReceiver
protected TCPConnectionMap.TCPConnection.ConnectionPeerReceiver connectionPeerReceiver
active
protected final java.util.concurrent.atomic.AtomicBoolean active
getPeerAddress
protected Address getPeerAddress()
updateLastAccessed
protected void updateLastAccessed()
start
protected void start(ThreadFactory f)
isSenderUsed
protected boolean isSenderUsed()
getSockAddress
protected java.lang.String getSockAddress()
send
protected void send(byte[] data,
int offset,
int length)
throws java.lang.Exception
- Parameters:
data
- Guaranteed to be non nulloffset
- length
-
- Throws:
java.lang.Exception
_send
protected void _send(byte[] data,
int offset,
int length,
boolean acquire_lock)
throws java.lang.Exception
- Sends data using the 'out' output stream of the socket
- Parameters:
data
- offset
- length
- acquire_lock
-
- Throws:
java.lang.Exception
doSend
protected void doSend(byte[] data,
int offset,
int length)
throws java.lang.Exception
- Throws:
java.lang.Exception
readPeerAddress
protected Address readPeerAddress(java.net.Socket client_sock)
throws java.lang.Exception
- Reads the peer's address. First a cookie has to be sent which has to
match my own cookie, otherwise the connection will be refused
- Throws:
java.lang.Exception
sendLocalAddress
protected void sendLocalAddress(Address local_addr)
throws java.lang.Exception
- Send the cookie first, then the our port number. If the cookie
doesn't match the receiver's cookie, the receiver will reject the
connection and close it.
- Throws:
java.lang.Exception
matchCookie
protected boolean matchCookie(byte[] input)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
isExpired
public boolean isExpired(long now)
- Specified by:
isExpired
in interface Connection
isConnected
public boolean isConnected()
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interface Connection
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface Connection
- Throws:
java.io.IOException
Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.