Package com.mysql.cj.protocol.a
Class TimeTrackingPacketSender
java.lang.Object
com.mysql.cj.protocol.a.TimeTrackingPacketSender
- All Implemented Interfaces:
MessageSender<NativePacketPayload>
,PacketSentTimeHolder
public class TimeTrackingPacketSender extends java.lang.Object implements MessageSender<NativePacketPayload>, PacketSentTimeHolder
A
MessageSender
which tracks the last time a packet was sent.-
Constructor Summary
Constructors Constructor Description TimeTrackingPacketSender(MessageSender<NativePacketPayload> packetSender)
-
Method Summary
Modifier and Type Method Description long
getLastPacketSentTime()
Returns the send time of a very recent packet.long
getPreviousPacketSentTime()
Returns the send time of a previous packet.void
send(byte[] packet, int packetLen, byte packetSequence)
Synchronously send the message to server.MessageSender<NativePacketPayload>
undecorate()
Return the previous PacketSender instance from the decorators chain or the current PacketSender if it is the first entry in a chain.MessageSender<NativePacketPayload>
undecorateAll()
Return a PacketSender instance free of decorators.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.mysql.cj.protocol.MessageSender
send, send, setMaxAllowedPacket
-
Constructor Details
-
Method Details
-
send
public void send(byte[] packet, int packetLen, byte packetSequence) throws java.io.IOExceptionDescription copied from interface:MessageSender
Synchronously send the message to server.- Specified by:
send
in interfaceMessageSender<NativePacketPayload>
- Parameters:
packet
- byte array containing a messagepacketLen
- length of the messagepacketSequence
- message sequence index (used in a native protocol)- Throws:
java.io.IOException
- if an error occurs
-
getLastPacketSentTime
public long getLastPacketSentTime()Description copied from interface:PacketSentTimeHolder
Returns the send time of a very recent packet. Should be used in exception generation when the send operation failed.- Specified by:
getLastPacketSentTime
in interfacePacketSentTimeHolder
- Returns:
- very recent packet send time
-
getPreviousPacketSentTime
public long getPreviousPacketSentTime()Description copied from interface:PacketSentTimeHolder
Returns the send time of a previous packet. Should be used in exception generation when the send operation was successful but the following read operation failed.- Specified by:
getPreviousPacketSentTime
in interfacePacketSentTimeHolder
- Returns:
- previous packet send time
-
undecorateAll
Description copied from interface:MessageSender
Return a PacketSender instance free of decorators.- Specified by:
undecorateAll
in interfaceMessageSender<NativePacketPayload>
- Returns:
MessageSender
instance
-
undecorate
Description copied from interface:MessageSender
Return the previous PacketSender instance from the decorators chain or the current PacketSender if it is the first entry in a chain.- Specified by:
undecorate
in interfaceMessageSender<NativePacketPayload>
- Returns:
MessageSender
instance
-