Top Description Methods
com.mysql.cj.protocol

public Interface MessageSender<M extends Message>

Known Direct Implementers
com.mysql.cj.protocol.a.CompressedPacketSender, com.mysql.cj.protocol.a.DebugBufferingPacketSender, com.mysql.cj.protocol.a.SimplePacketSender, com.mysql.cj.protocol.a.TimeTrackingPacketSender, com.mysql.cj.protocol.a.TracingPacketSender, com.mysql.cj.protocol.x.SyncMessageSender
Type Parameters
<M>
Message type
Imports
java.io.IOException, java.util.concurrent.CompletableFuture, com.mysql.cj.exceptions.CJOperationNotSupportedException, .ExceptionFactory

This interface provides a facility for sending messages to server. The destination, transmission method, etc are determined by the implementation.

Method Summary

Modifier and TypeMethod and Description
public default void
send(byte[]
byte array containing a message
message
,
int
length of the message
messageLen
,
byte
message sequence index (used in a native protocol)
messageSequence
)

Synchronously send the message to server.

public default void
send(M
Message instance
message
)

Synchronously send the message to server.

public default CompletableFuture<?>

Returns:

result
send
(M
message extending Message
message
,
CompletableFuture<?>
a Future returning operation result
future
,
Runnable
a callback to receive notification of when the message is completely written
callback
)

Asynchronously write a message with a notification being delivered to callback upon completion of write of entire message.

public default void
setMaxAllowedPacket(int
max allowed packet size
maxAllowedPacket
)

Set max allowed packet size.

public default MessageSender<M>

Returns:

MessageSender instance
undecorate
()

Return the previous PacketSender instance from the decorators chain or the current PacketSender if it is the first entry in a chain.

public default MessageSender<M>

Returns:

MessageSender instance
undecorateAll
()

Return a PacketSender instance free of decorators.

Method Detail

sendback to summary
public default void send(byte[] message, int messageLen, byte messageSequence) throws IOException

Synchronously send the message to server.

Parameters
message:byte[]

byte array containing a message

messageLen:int

length of the message

messageSequence:byte

message sequence index (used in a native protocol)

Exceptions
IOException:
if an error occurs
sendback to summary
public default void send(M message)

Synchronously send the message to server.

Parameters
message:M

Message instance

sendback to summary
public default CompletableFuture<?> send(M message, CompletableFuture<?> future, Runnable callback)

Asynchronously write a message with a notification being delivered to callback upon completion of write of entire message.

Parameters
message:M

message extending Message

future:CompletableFuture<?>

a Future returning operation result

callback:Runnable

a callback to receive notification of when the message is completely written

Returns:CompletableFuture<?>

result

setMaxAllowedPacketback to summary
public default void setMaxAllowedPacket(int maxAllowedPacket)

Set max allowed packet size.

Parameters
maxAllowedPacket:int

max allowed packet size

undecorateback to summary
public default MessageSender<M> undecorate()

Return the previous PacketSender instance from the decorators chain or the current PacketSender if it is the first entry in a chain.

Returns:MessageSender<M>

MessageSender instance

undecorateAllback to summary
public default MessageSender<M> undecorateAll()

Return a PacketSender instance free of decorators.

Returns:MessageSender<M>

MessageSender instance