接口 MessageSender<M extends Message>
-
- 类型参数:
M- Message type
- 所有已知实现类:
CompressedPacketSender,DebugBufferingPacketSender,SimplePacketSender,SyncMessageSender,TimeTrackingPacketSender,TracingPacketSender
public interface MessageSender<M extends Message>This interface provides a facility for sending messages to server. The destination, transmission method, etc are determined by the implementation.
-
-
方法概要
所有方法 实例方法 默认方法 修饰符和类型 方法 说明 default voidsend(byte[] message, int messageLen, byte messageSequence)Synchronously send the message to server.default voidsend(M message)Synchronously send the message to server.default CompletableFuture<?>send(M message, CompletableFuture<?> future, Runnable callback)Asynchronously write a message with a notification being delivered tocallbackupon completion of write of entire message.default voidsetMaxAllowedPacket(int maxAllowedPacket)Set max allowed packet size.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.default MessageSender<M>undecorateAll()Return a PacketSender instance free of decorators.
-
-
-
方法详细资料
-
send
default void send(byte[] message, int messageLen, byte messageSequence) throws IOExceptionSynchronously send the message to server.- 参数:
message- byte array containing a messagemessageLen- length of the messagemessageSequence- message sequence index (used in a native protocol)- 抛出:
IOException- if an error occurs
-
send
default void send(M message)
Synchronously send the message to server.- 参数:
message-Messageinstance
-
send
default CompletableFuture<?> send(M message, CompletableFuture<?> future, Runnable callback)
Asynchronously write a message with a notification being delivered tocallbackupon completion of write of entire message.- 参数:
message- message extendingMessagefuture- a Future returning operation resultcallback- a callback to receive notification of when the message is completely written- 返回:
- result
-
setMaxAllowedPacket
default void setMaxAllowedPacket(int maxAllowedPacket)
Set max allowed packet size.- 参数:
maxAllowedPacket- max allowed packet size
-
undecorateAll
default MessageSender<M> undecorateAll()
Return a PacketSender instance free of decorators.- 返回:
MessageSenderinstance
-
undecorate
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.- 返回:
MessageSenderinstance
-
-