Package org.forgerock.opendj.io
Interface RxServerSocket<M,S extends RxSocket<M>>
-
- Type Parameters:
M- The type of messages transferred by the server socket.S- The type of reactive sockets exposed by the server socket.
- All Superinterfaces:
AutoCloseable,Closeable
public interface RxServerSocket<M,S extends RxSocket<M>> extends Closeable
A reactive server socket listens for incoming connections and binds them to aRxSocket.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Single<S>accept()Returns a "cold"Singlewhich will accept the next client connection each time it is subscribed.voidclose()Closes this server socket causing theSubscriberto complete if currently subscribed.OptionsgetOptions()Returns a copy of the options currently used by this server socket.InetSocketAddressgetSocketAddress()Returns the address that this server socket is listening on.booleansetOptions(Options newOptions)Updates the options of this server socket.
-
-
-
Method Detail
-
accept
@CheckReturnValue Single<S> accept()
Returns a "cold"Singlewhich will accept the next client connection each time it is subscribed. Accept operations cannot be cancelled: cancelling/disposing a subscription has no effect, and will not close the underlying server socket.Note that invoking this method multiple times returns the same
Singleinstance. The returnedSinglewill not allow multiple concurrent subscriptions as this will result in non-deterministic behavior. Attempts to have multiple concurrent subscriptions will result in anIllegalStateException.Subscribers will be notified when the socket is closed through
SingleObserver.onError(Throwable)with the correspondingIOExceptionproviding the reason for the disconnection. In particular, if the socket is closed locally viaclose()then it will be notified withRxSocket.LOCAL_CLOSE.- Returns:
- A "cold"
Singlewhich will be signalled once the accept operation completes or fails.
-
getSocketAddress
InetSocketAddress getSocketAddress()
Returns the address that this server socket is listening on.- Returns:
- The address that this server socket is listening on.
-
setOptions
boolean setOptions(Options newOptions)
Updates the options of this server socket. Most of the options will be applied only for next incoming connections, current connections will not be impacted by this operation. Some options are not modifiable and will be ignored by this operation.- Parameters:
newOptions- The socket options.- Returns:
trueif some or all options have been applied,falseif options cannot be changed.
-
getOptions
Options getOptions()
Returns a copy of the options currently used by this server socket. Modifying the returned options will have no impact until applied withsetOptions(Options).- Returns:
- The server socket options.
-
close
void close()
Closes this server socket causing theSubscriberto complete if currently subscribed. Calling this method on a server socket that is already closed has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-