mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 08:51:19 +00:00
NetSocketInternal#writeMessage(Object) should return a Future<Void> and not be fluent
This commit is contained in:
@@ -120,12 +120,13 @@ public class NetSocketImpl extends ConnectionBase implements NetSocketInternal {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized NetSocketInternal writeMessage(Object message) {
|
||||
public synchronized Future<Void> writeMessage(Object message) {
|
||||
if (closed) {
|
||||
throw new IllegalStateException("Socket is closed");
|
||||
}
|
||||
writeToChannel(message);
|
||||
return this;
|
||||
Promise<Void> promise = Promise.promise();
|
||||
writeMessage(message, promise);
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,7 @@ package io.vertx.core.net.impl;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.net.NetSocket;
|
||||
|
||||
@@ -56,7 +57,7 @@ public interface NetSocketInternal extends NetSocket {
|
||||
* @param message the message to write, it should be handled by one of the channel pipeline handlers
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
NetSocketInternal writeMessage(Object message);
|
||||
Future<Void> writeMessage(Object message);
|
||||
|
||||
/**
|
||||
* Like {@link #writeMessage(Object)} but with an {@code handler} called when the message has been written
|
||||
|
||||
Reference in New Issue
Block a user