public interface Server
This is a low-level abstraction through which Catalyst servers receive connections from clients. Users should never use this API directly.
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Void> |
close()
Closes the server.
|
UUID |
id()
Returns the server ID.
|
CompletableFuture<Void> |
listen(Address address,
Consumer<Connection> listener)
Listens for connections on the server.
|
UUID id()
The server ID is a globally unique UUID through which the server can be identified.
CompletableFuture<Void> listen(Address address, Consumer<Connection> listener)
Once the server has started listening on the provided address, Consumer.accept(Object) will be
called for the provided Consumer each time a new connection to the server is established.
The provided connection's Connection.id() will reflect the
Client.id() of the client that connected to the server and not the
id() of the server itself.
Once the server has bound to the provided address the returned
CompletableFuture will be completed.
address - The address on which to listen for connections.NullPointerException - if address ir listener are nullCompletableFuture<Void> close()
When the server is closed, any close listeners registered
on the server's Connections will be invoked prior to shutdown.
Copyright © 2013–2015. All rights reserved.