Class NetServer
- java.lang.Object
-
- io.vertx.mutiny.core.net.NetServer
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<NetServer>
__TYPE_ARG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
actualPort()
io.smallrye.mutiny.Uni<Void>
close()
Likeclose()
but supplying a handler that will be notified when close is complete.Void
closeAndAwait()
Blocking variant ofclose()
.void
closeAndForget()
Variant ofclose()
that ignores the result of the operation.NetServer
connectHandler(Consumer<NetSocket> handler)
ReadStream<NetSocket>
connectStream()
boolean
equals(Object o)
io.vertx.core.net.NetServer
getDelegate()
int
hashCode()
boolean
isMetricsEnabled()
io.smallrye.mutiny.Uni<NetServer>
listen()
Likelisten()
but providing a handler that will be notified when the server is listening, or fails.io.smallrye.mutiny.Uni<NetServer>
listen(int port)
Likelisten()
but providing a handler that will be notified when the server is listening, or fails.io.smallrye.mutiny.Uni<NetServer>
listen(int port, String host)
Likelisten()
but providing a handler that will be notified when the server is listening, or fails.io.smallrye.mutiny.Uni<NetServer>
listen(SocketAddress localAddress)
Likelisten()
but providing a handler that will be notified when the server is listening, or fails.NetServer
listenAndAwait()
Blocking variant oflisten()
.NetServer
listenAndAwait(int port)
Blocking variant oflisten(int)
.NetServer
listenAndAwait(int port, String host)
Blocking variant oflisten(int,String)
.NetServer
listenAndAwait(SocketAddress localAddress)
Blocking variant oflisten(io.vertx.mutiny.core.net.SocketAddress)
.NetServer
listenAndForget()
Variant oflisten()
that ignores the result of the operation.NetServer
listenAndForget(int port)
Variant oflisten(int)
that ignores the result of the operation.NetServer
listenAndForget(int port, String host)
Variant oflisten(int,String)
that ignores the result of the operation.NetServer
listenAndForget(SocketAddress localAddress)
Variant oflisten(io.vertx.mutiny.core.net.SocketAddress)
that ignores the result of the operation.static NetServer
newInstance(io.vertx.core.net.NetServer arg)
String
toString()
-
-
-
Constructor Detail
-
NetServer
public NetServer(io.vertx.core.net.NetServer delegate)
-
NetServer
public NetServer(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.core.net.NetServer getDelegate()
- Specified by:
getDelegate
in interfaceMeasured
-
isMetricsEnabled
public boolean isMetricsEnabled()
- Specified by:
isMetricsEnabled
in interfaceMeasured
- Returns:
true
if metrics are enabled
-
connectStream
public ReadStream<NetSocket> connectStream()
- Returns:
- the connect stream
-
connectHandler
public NetServer connectHandler(Consumer<NetSocket> handler)
- Parameters:
handler
-- Returns:
-
listen
@CheckReturnValue public io.smallrye.mutiny.Uni<NetServer> listen()
Likelisten()
but providing a handler that will be notified when the server is listening, or fails.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
listenAndAwait
public NetServer listenAndAwait()
Blocking variant oflisten()
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the NetServer instance produced by the operation.
-
listenAndForget
public NetServer listenAndForget()
Variant oflisten()
that ignores the result of the operation.This method subscribes on the result of
listen()
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromlisten()
but you don't need to compose it with other operations.- Returns:
- the instance of NetServer to chain method calls.
-
listen
@CheckReturnValue public io.smallrye.mutiny.Uni<NetServer> listen(int port, String host)
Likelisten()
but providing a handler that will be notified when the server is listening, or fails.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
port
- the port to listen onhost
- the host to listen on- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
listenAndAwait
public NetServer listenAndAwait(int port, String host)
Blocking variant oflisten(int,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
port
- the port to listen onhost
- the host to listen on- Returns:
- the NetServer instance produced by the operation.
-
listenAndForget
public NetServer listenAndForget(int port, String host)
Variant oflisten(int,String)
that ignores the result of the operation.This method subscribes on the result of
listen(int,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromlisten(int,String)
but you don't need to compose it with other operations.- Parameters:
port
- the port to listen onhost
- the host to listen on- Returns:
- the instance of NetServer to chain method calls.
-
listen
@CheckReturnValue public io.smallrye.mutiny.Uni<NetServer> listen(int port)
Likelisten()
but providing a handler that will be notified when the server is listening, or fails.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
port
- the port to listen on- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
listenAndAwait
public NetServer listenAndAwait(int port)
Blocking variant oflisten(int)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
port
- the port to listen on- Returns:
- the NetServer instance produced by the operation.
-
listenAndForget
public NetServer listenAndForget(int port)
Variant oflisten(int)
that ignores the result of the operation.This method subscribes on the result of
listen(int)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromlisten(int)
but you don't need to compose it with other operations.- Parameters:
port
- the port to listen on- Returns:
- the instance of NetServer to chain method calls.
-
listen
@CheckReturnValue public io.smallrye.mutiny.Uni<NetServer> listen(SocketAddress localAddress)
Likelisten()
but providing a handler that will be notified when the server is listening, or fails.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
localAddress
- the local address to listen on- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
listenAndAwait
public NetServer listenAndAwait(SocketAddress localAddress)
Blocking variant oflisten(io.vertx.mutiny.core.net.SocketAddress)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
localAddress
- the local address to listen on- Returns:
- the NetServer instance produced by the operation.
-
listenAndForget
public NetServer listenAndForget(SocketAddress localAddress)
Variant oflisten(io.vertx.mutiny.core.net.SocketAddress)
that ignores the result of the operation.This method subscribes on the result of
listen(io.vertx.mutiny.core.net.SocketAddress)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromlisten(io.vertx.mutiny.core.net.SocketAddress)
but you don't need to compose it with other operations.- Parameters:
localAddress
- the local address to listen on- Returns:
- the instance of NetServer to chain method calls.
-
close
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
Likeclose()
but supplying a handler that will be notified when close is complete.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
closeAndAwait
public Void closeAndAwait()
Blocking variant ofclose()
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
closeAndForget
public void closeAndForget()
-
actualPort
public int actualPort()
- Returns:
- the actual port the server is listening on.
-
newInstance
public static NetServer newInstance(io.vertx.core.net.NetServer arg)
-
-