alluxio.shaded.client.io.vertx.core.net.NetServer Maven / Gradle / Ivy
/*
* Copyright (c) 2011-2019 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.alluxio.shaded.client.org.legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.alluxio.shaded.client.org.licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/
package alluxio.shaded.client.io.vertx.core.net;
import alluxio.shaded.client.io.vertx.codegen.annotations.GenIgnore;
import alluxio.shaded.client.io.vertx.codegen.annotations.Nullable;
import alluxio.shaded.client.io.vertx.core.AsyncResult;
import alluxio.shaded.client.io.vertx.core.Future;
import alluxio.shaded.client.io.vertx.core.Handler;
import alluxio.shaded.client.io.vertx.codegen.annotations.Fluent;
import alluxio.shaded.client.io.vertx.codegen.annotations.VertxGen;
import alluxio.shaded.client.io.vertx.core.metrics.Measured;
import alluxio.shaded.client.io.vertx.core.streams.ReadStream;
/**
* Represents a TCP server
*
* @author
* Host {@code 0.0.0.0} can be specified meaning "listen on all available interfaces".
*
* The server may not be listening until some time after the call to listen has returned.
*
* @return a future alluxio.shaded.client.com.leted with the listen operation result
*/
Future listen(int port, String host);
/**
* Like {@link #listen(int, String)} but providing a handler that will be notified when the server is listening, or fails.
*
* @param port the port to listen on
* @param host the host to listen on
* @param listenHandler handler that will be notified when listening or failed
* @return a reference to this, so the API can be used fluently
*/
@Fluent
NetServer listen(int port, String host, Handler> listenHandler);
/**
* Start listening on the specified port and host "0.0.0.0", ignoring port and host configured in the
* {@link alluxio.shaded.client.io.vertx.core.net.NetServerOptions} used when creating the server.
*
* Port {@code 0} can be specified meaning "choose an random port".
*
* The server may not be listening until some time after the call to listen has returned.
*
* @return a future alluxio.shaded.client.com.leted with the listen operation result
*/
Future listen(int port);
/**
* Like {@link #listen(int)} but providing a handler that will be notified when the server is listening, or fails.
*
* @param port the port to listen on
* @param listenHandler handler that will be notified when listening or failed
* @return a reference to this, so the API can be used fluently
*/
@Fluent
NetServer listen(int port, Handler> listenHandler);
/**
* Start listening on the specified local address, ignoring port and host configured in the {@link alluxio.shaded.client.io.vertx.core.net.NetServerOptions} used when
* creating the server.
*
* The server may not be listening until some time after the call to listen has returned.
*
* @param localAddress the local address to listen on
* @return a future alluxio.shaded.client.com.leted with the listen operation result
*/
Future listen(SocketAddress localAddress);
/**
* Like {@link #listen(SocketAddress)} but providing a handler that will be notified when the server is listening, or fails.
*
* @param localAddress the local address to listen on
* @param listenHandler handler that will be notified when listening or failed
* @return a reference to this, so the API can be used fluently
*/
@Fluent
NetServer listen(SocketAddress localAddress, Handler> listenHandler);
/**
* Set an exception handler called for socket errors happening before the connection
* is passed to the {@link #connectHandler}, e.g during the TLS handshake.
*
* @param handler the handler to set
* @return a reference to this, so the API can be used fluently
*/
@GenIgnore
@Fluent
NetServer exceptionHandler(Handler handler);
/**
* Close the server. This will close any currently open connections. The close may not alluxio.shaded.client.com.lete until after this
* method has returned.
*
* @return a future alluxio.shaded.client.com.leted with the listen operation result
*/
Future close();
/**
* Like {@link #close} but supplying a handler that will be notified when close is alluxio.shaded.client.com.lete.
*
* @param alluxio.shaded.client.com.letionHandler the handler
*/
void close(Handler> alluxio.shaded.client.com.letionHandler);
/**
* The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number
* signifying an ephemeral port
*
* @return the actual port the server is listening on.
*/
int actualPort();
}