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 longgetLastPacketSentTime()Returns the send time of a very recent packet.longgetPreviousPacketSentTime()Returns the send time of a previous packet.voidsend(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, waitMethods 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:MessageSenderSynchronously send the message to server.- Specified by:
sendin 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:PacketSentTimeHolderReturns the send time of a very recent packet. Should be used in exception generation when the send operation failed.- Specified by:
getLastPacketSentTimein interfacePacketSentTimeHolder- Returns:
- very recent packet send time
-
getPreviousPacketSentTime
public long getPreviousPacketSentTime()Description copied from interface:PacketSentTimeHolderReturns 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:
getPreviousPacketSentTimein interfacePacketSentTimeHolder- Returns:
- previous packet send time
-
undecorateAll
Description copied from interface:MessageSenderReturn a PacketSender instance free of decorators.- Specified by:
undecorateAllin interfaceMessageSender<NativePacketPayload>- Returns:
MessageSenderinstance
-
undecorate
Description copied from interface:MessageSenderReturn the previous PacketSender instance from the decorators chain or the current PacketSender if it is the first entry in a chain.- Specified by:
undecoratein interfaceMessageSender<NativePacketPayload>- Returns:
MessageSenderinstance
-