Object
MessageSender
- All Implemented Interfaces:
CompletionHandler<Integer,
AsynchronousSocketChannel>
public class MessageSender
extends Object
implements CompletionHandler<Integer,AsynchronousSocketChannel>
Async sends the message and notifies the caller thru the CompletableFuture. This handler is not
thread safe and designed to serve only one send request at a time.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
completed
(Integer result, AsynchronousSocketChannel channel) void
failed
(Throwable exc, AsynchronousSocketChannel channel) send
(ByteBuffer message, Consumer<Throwable> errorHandler) Send data asynchronously and return the future which will be completed once all data is sent.
-
Constructor Details
-
MessageSender
-
-
Method Details
-
completed
- Specified by:
completed
in interfaceCompletionHandler<Integer,
AsynchronousSocketChannel>
-
failed
- Specified by:
failed
in interfaceCompletionHandler<Integer,
AsynchronousSocketChannel>
-
send
Send data asynchronously and return the future which will be completed once all data is sent.
-