Class TcpPacketSender
- java.lang.Object
-
- net.timewalker.ffmq4.transport.tcp.io.AbstractTcpPacketHandler
-
- net.timewalker.ffmq4.transport.tcp.io.TcpPacketSender
-
- All Implemented Interfaces:
Runnable,ActiveObject
public final class TcpPacketSender extends AbstractTcpPacketHandler implements Runnable
Thread handling the outgoing traffic of a TCP socket. The TcpPacketSender is also responsible for sending keep-alive pings when the connection is idle.
-
-
Field Summary
-
Fields inherited from class net.timewalker.ffmq4.transport.tcp.io.AbstractTcpPacketHandler
id, lastActivity, listener
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTcpPacketSender(TcpPacketTransport transport, NetworkOutputChannel outputChannel, PacketTransportListener listener, int pingInterval, int sendQueueMaxSize)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetTimeoutDelay()Get the maximum allowed time between activitiesbooleanneedsThrottling()booleanonActivityTimeout()Called if the object has been inactive for morevoidpleaseStop()voidrun()voidsend(AbstractPacket packet)Send a packet-
Methods inherited from class net.timewalker.ffmq4.transport.tcp.io.AbstractTcpPacketHandler
getId, getLastActivity
-
-
-
-
Constructor Detail
-
TcpPacketSender
protected TcpPacketSender(TcpPacketTransport transport, NetworkOutputChannel outputChannel, PacketTransportListener listener, int pingInterval, int sendQueueMaxSize)
Constructor
-
-
Method Detail
-
send
public void send(AbstractPacket packet)
Send a packet
-
needsThrottling
public boolean needsThrottling()
-
getTimeoutDelay
public long getTimeoutDelay()
Description copied from interface:ActiveObjectGet the maximum allowed time between activities- Specified by:
getTimeoutDelayin interfaceActiveObject- Returns:
- a delay in milliseconds
-
onActivityTimeout
public boolean onActivityTimeout() throws ExceptionDescription copied from interface:ActiveObjectCalled if the object has been inactive for more- Specified by:
onActivityTimeoutin interfaceActiveObject- Returns:
- true if the object should be unregistered immediately upon return
- Throws:
Exception
-
pleaseStop
public void pleaseStop()
-
-