Package org.jgroups.blocks.cs
Class TcpConnectionNonBlocking
java.lang.Object
org.jgroups.blocks.cs.Connection
org.jgroups.blocks.cs.TcpConnection
org.jgroups.blocks.cs.TcpConnectionNonBlocking
- All Implemented Interfaces:
Closeable,AutoCloseable
TCP connection which (despite the fancy name) blocks only a single thread at most. Uses a bounded queue, to which
senders add their messages, and a single consumer sending the messages. When the queue is full, messages will
get dropped. Therefore, at most one thread is blocked on TCP write when the send-window is full.
Link: https://issues.redhat.com/browse/JGRP-2759
- Since:
- 5.3.3
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.jgroups.blocks.cs.TcpConnection
TcpConnection.Receiver -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LongAdderprotected intprotected final BlockingQueue<ByteArray> protected TcpConnectionNonBlocking.SenderFields inherited from class org.jgroups.blocks.cs.TcpConnection
connected, in, length_buf, out, receiver, send_lock, sock, writersFields inherited from class org.jgroups.blocks.cs.Connection
cookie, last_access, peer_addr, server -
Constructor Summary
ConstructorsConstructorDescriptionTcpConnectionNonBlocking(Socket s, TcpServer server, int max_size) TcpConnectionNonBlocking(Address peer_addr, TcpBaseServer server, int max_size) -
Method Summary
Methods inherited from class org.jgroups.blocks.cs.TcpConnection
connect, connect, createDataInputStream, createDataOutputStream, doSend, doSend, flush, getSockAddress, isClosed, isConnected, isConnectionPending, localAddress, readPeerAddress, send, sendLocalAddress, setSocketParameters, statusMethods inherited from class org.jgroups.blocks.cs.Connection
getTimestamp, isExpired, peerAddress, updateLastAccessed
-
Field Details
-
queue
-
max_size
protected int max_size -
sender
-
dropped_msgs
-
-
Constructor Details
-
TcpConnectionNonBlocking
public TcpConnectionNonBlocking(Address peer_addr, TcpBaseServer server, int max_size) throws Exception - Throws:
Exception
-
TcpConnectionNonBlocking
- Throws:
Exception
-
-
Method Details
-
maxSize
public int maxSize() -
droppedMessages
public long droppedMessages() -
queueSize
public int queueSize() -
start
public void start()- Overrides:
startin classTcpConnection
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classTcpConnection- Throws:
IOException
-
send
- Overrides:
sendin classTcpConnection- Throws:
Exception
-
toString
- Overrides:
toStringin classTcpConnection
-
name
-
senderRunning
protected boolean senderRunning()
-