Package org.jgroups.protocols
Class SimpleTCP.Connection
- java.lang.Object
-
- org.jgroups.protocols.SimpleTCP.Connection
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Runnable
- Enclosing class:
- SimpleTCP
protected class SimpleTCP.Connection extends java.lang.Object implements java.lang.Runnable, java.io.Closeable
1 connection per peer to send and receive messages
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
buffer
protected java.io.DataInputStream
in
protected java.io.DataOutputStream
out
protected IpAddress
peer_addr
protected Runner
runner
protected java.net.Socket
sock
protected java.util.concurrent.atomic.AtomicInteger
writers
-
Constructor Summary
Constructors Constructor Description Connection(java.net.Socket sock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected java.io.BufferedInputStream
createBufferedInputStream(java.io.InputStream in)
protected java.io.BufferedOutputStream
createBufferedOutputStream(java.io.OutputStream out)
void
run()
protected void
send(byte[] buffer, int offset, int length)
protected SimpleTCP.Connection
start()
java.lang.String
toString()
-
-
-
Field Detail
-
sock
protected final java.net.Socket sock
-
peer_addr
protected final IpAddress peer_addr
-
in
protected final java.io.DataInputStream in
-
out
protected final java.io.DataOutputStream out
-
runner
protected final Runner runner
-
buffer
protected byte[] buffer
-
writers
protected final java.util.concurrent.atomic.AtomicInteger writers
-
-
Method Detail
-
start
protected SimpleTCP.Connection start()
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
send
protected void send(byte[] buffer, int offset, int length) throws java.lang.Exception
- Throws:
java.lang.Exception
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
createBufferedOutputStream
protected java.io.BufferedOutputStream createBufferedOutputStream(java.io.OutputStream out)
-
createBufferedInputStream
protected java.io.BufferedInputStream createBufferedInputStream(java.io.InputStream in)
-
-