类 TimeTrackingPacketReader
- java.lang.Object
-
- com.mysql.cj.protocol.a.TimeTrackingPacketReader
-
public class TimeTrackingPacketReader extends Object implements MessageReader<NativePacketHeader,NativePacketPayload>, PacketReceivedTimeHolder
AMessageReaderwhich tracks the last time a packet was received.
-
-
构造器概要
构造器 构造器 说明 TimeTrackingPacketReader(MessageReader<NativePacketHeader,NativePacketPayload> messageReader)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 longgetLastPacketReceivedTime()bytegetMessageSequence()Get last message sequence number, as it was stored byMessageReader.readHeader().NativePacketHeaderprobeHeader()Read the next message header from server, possibly blocking indefinitely until the message is received, and cache it so that the nextMessageReader.readHeader()return the same header.NativePacketPayloadprobeMessage(Optional<NativePacketPayload> reuse, NativePacketHeader header)Read message from server into to the givenMessageinstance or into the new one if not present and cache it so that the nextMessageReader.readMessage(Optional, MessageHeader)return the same message.NativePacketHeaderreadHeader()Read the next message header from server, possibly blocking indefinitely until the message is received.NativePacketPayloadreadMessage(Optional<NativePacketPayload> reuse, NativePacketHeader header)Read message from server into to the givenMessageinstance or into the new one if not present.voidresetMessageSequence()Set stored message sequence number to 0.MessageReader<NativePacketHeader,NativePacketPayload>undecorate()Return the previous MessageReader instance from the decorators chain or the current MessageReader if it is the first entry in a chain.MessageReader<NativePacketHeader,NativePacketPayload>undecorateAll()Return a MessageReader instance free of decorators.-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 com.mysql.cj.protocol.MessageReader
pushMessageListener, readMessage, start, stopAfterNextMessage
-
-
-
-
构造器详细资料
-
TimeTrackingPacketReader
public TimeTrackingPacketReader(MessageReader<NativePacketHeader,NativePacketPayload> messageReader)
-
-
方法详细资料
-
readHeader
public NativePacketHeader readHeader() throws IOException
从接口复制的说明:MessageReaderRead the next message header from server, possibly blocking indefinitely until the message is received.- 指定者:
readHeader在接口中MessageReader<NativePacketHeader,NativePacketPayload>- 返回:
MessageHeaderof the next message- 抛出:
IOException- if an error occurs
-
probeHeader
public NativePacketHeader probeHeader() throws IOException
从接口复制的说明:MessageReaderRead the next message header from server, possibly blocking indefinitely until the message is received, and cache it so that the nextMessageReader.readHeader()return the same header.- 指定者:
probeHeader在接口中MessageReader<NativePacketHeader,NativePacketPayload>- 返回:
MessageHeaderof the next message- 抛出:
IOException- if an error occurs
-
readMessage
public NativePacketPayload readMessage(Optional<NativePacketPayload> reuse, NativePacketHeader header) throws IOException
从接口复制的说明:MessageReaderRead message from server into to the givenMessageinstance or into the new one if not present. For asynchronous channel it synchronously reads the next message in the stream, blocking until the message is read fully. Could throw CJCommunicationsException wrapping anIOExceptionduring read or parse- 指定者:
readMessage在接口中MessageReader<NativePacketHeader,NativePacketPayload>- 参数:
reuse-Messageobject to reuse. May be ignored by implementation.header-MessageHeaderinstance- 返回:
Messageinstance- 抛出:
IOException- if an error occurs
-
probeMessage
public NativePacketPayload probeMessage(Optional<NativePacketPayload> reuse, NativePacketHeader header) throws IOException
从接口复制的说明:MessageReaderRead message from server into to the givenMessageinstance or into the new one if not present and cache it so that the nextMessageReader.readMessage(Optional, MessageHeader)return the same message. For asynchronous channel it synchronously reads the next message in the stream, blocking until the message is read fully. Could throw CJCommunicationsException wrapping anIOExceptionduring read or parse- 指定者:
probeMessage在接口中MessageReader<NativePacketHeader,NativePacketPayload>- 参数:
reuse-Messageobject to reuse. May be ignored by implementation.header-MessageHeaderinstance- 返回:
Messageinstance- 抛出:
IOException- if an error occurs
-
getLastPacketReceivedTime
public long getLastPacketReceivedTime()
-
getMessageSequence
public byte getMessageSequence()
从接口复制的说明:MessageReaderGet last message sequence number, as it was stored byMessageReader.readHeader().- 指定者:
getMessageSequence在接口中MessageReader<NativePacketHeader,NativePacketPayload>- 返回:
- number
-
resetMessageSequence
public void resetMessageSequence()
从接口复制的说明:MessageReaderSet stored message sequence number to 0.
-
undecorateAll
public MessageReader<NativePacketHeader,NativePacketPayload> undecorateAll()
从接口复制的说明:MessageReaderReturn a MessageReader instance free of decorators.- 指定者:
undecorateAll在接口中MessageReader<NativePacketHeader,NativePacketPayload>- 返回:
MessageReader
-
undecorate
public MessageReader<NativePacketHeader,NativePacketPayload> undecorate()
从接口复制的说明:MessageReaderReturn the previous MessageReader instance from the decorators chain or the current MessageReader if it is the first entry in a chain.- 指定者:
undecorate在接口中MessageReader<NativePacketHeader,NativePacketPayload>- 返回:
MessageReader
-
-