Package com.mysql.cj.protocol.x
Class SyncMessageSender
java.lang.Object
com.mysql.cj.protocol.x.SyncMessageSender
- All Implemented Interfaces:
MessageSender<XMessage>,PacketSentTimeHolder
public class SyncMessageSender extends java.lang.Object implements MessageSender<XMessage>, PacketSentTimeHolder
Synchronous-only implementation of
MessageSender.-
Constructor Summary
Constructors Constructor Description SyncMessageSender(java.io.OutputStream os) -
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(XMessage message)Synchronously send the message to server.java.util.concurrent.CompletableFuture<?>send(XMessage message, java.util.concurrent.CompletableFuture<?> future, java.lang.Runnable callback)Asynchronously write a message with a notification being delivered tocallbackupon completion of write of entire message.voidsetMaxAllowedPacket(int maxAllowedPacket)Set max allowed packet size.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, undecorate, undecorateAll
-
Constructor Details
-
SyncMessageSender
public SyncMessageSender(java.io.OutputStream os)
-
-
Method Details
-
send
Description copied from interface:MessageSenderSynchronously send the message to server.- Specified by:
sendin interfaceMessageSender<XMessage>- Parameters:
message-Messageinstance
-
send
public java.util.concurrent.CompletableFuture<?> send(XMessage message, java.util.concurrent.CompletableFuture<?> future, java.lang.Runnable callback)Description copied from interface:MessageSenderAsynchronously write a message with a notification being delivered tocallbackupon completion of write of entire message.- Specified by:
sendin interfaceMessageSender<XMessage>- Parameters:
message- message extendingMessagefuture- a Future returning operation resultcallback- a callback to receive notification of when the message is completely written- Returns:
- result
-
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
-
setMaxAllowedPacket
public void setMaxAllowedPacket(int maxAllowedPacket)Description copied from interface:MessageSenderSet max allowed packet size.- Specified by:
setMaxAllowedPacketin interfaceMessageSender<XMessage>- Parameters:
maxAllowedPacket- max allowed packet size
-