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
A reactive server socket listens for incoming connections and binds them to a
RxSocket
.-
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Single<S>
accept()
Returns a "cold"Single
which will accept the next client connection each time it is subscribed.void
close()
Closes this server socket causing theSubscriber
to complete if currently subscribed.Returns a copy of the options currently used by this server socket.Returns the address that this server socket is listening on.boolean
setOptions
(Options newOptions) Updates the options of this server socket.
-
Method Details
-
accept
Returns a "cold"Single
which 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
Single
instance. The returnedSingle
will 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 correspondingIOException
providing 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"
Single
which 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
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:
true
if some or all options have been applied,false
if 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 theSubscriber
to complete if currently subscribed. Calling this method on a server socket that is already closed has no effect.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-