Class Reactor2TcpConnection<P>
- java.lang.Object
- org.springframework.messaging.tcp.reactor.Reactor2TcpConnection<P>
- Type Parameters:
P- the payload type of messages read or written to the TCP stream.
- All Implemented Interfaces:
Closeable,AutoCloseable,TcpConnection<P>
public class Reactor2TcpConnection<P> extends Object implements TcpConnection<P>
An implementation ofTcpConnectionbased on the TCP client support of the Reactor project.- Since:
- 4.2
- Author:
- Rossen Stoyanchev
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the connection.voidonReadInactivity(Runnable runnable, long inactivityDuration)Register a task to invoke after a period of read inactivity.voidonWriteInactivity(Runnable runnable, long inactivityDuration)Register a task to invoke after a period of write inactivity.ListenableFuture<Void>send(Message<P> message)Send the given message.
Method Detail
send
public ListenableFuture<Void> send(Message<P> message)
Description copied from interface:TcpConnectionSend the given message.- Specified by:
sendin interfaceTcpConnection<P>- Parameters:
message- the message- Returns:
- a ListenableFuture that can be used to determine when and if the message was successfully sent
onReadInactivity
public void onReadInactivity(Runnable runnable, long inactivityDuration)
Description copied from interface:TcpConnectionRegister a task to invoke after a period of read inactivity.- Specified by:
onReadInactivityin interfaceTcpConnection<P>- Parameters:
runnable- the task to invokeinactivityDuration- the amount of inactive time in milliseconds
onWriteInactivity
public void onWriteInactivity(Runnable runnable, long inactivityDuration)
Description copied from interface:TcpConnectionRegister a task to invoke after a period of write inactivity.- Specified by:
onWriteInactivityin interfaceTcpConnection<P>- Parameters:
runnable- the task to invokeinactivityDuration- the amount of inactive time in milliseconds
close
public void close()
Description copied from interface:TcpConnectionClose the connection.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceTcpConnection<P>