public class ConnectionManager<T extends NetworkContext<T>> extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
ConnectionManager.ConnectionListener<T extends NetworkContext<T>> |
static class |
ConnectionManager.EventEmitterToken
An opaque token that NetworkContext connection event emitters need to retain and
provide when they dispatch events.
|
| Constructor and Description |
|---|
ConnectionManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(@NotNull ConnectionManager.ConnectionListener<T> connectionListener) |
void |
executeNewListeners(T nc,
@NotNull ConnectionManager.EventEmitterToken token)
Execute any new connection listeners that have been added since the emitter last emitted
a connection event.
|
ConnectionManager.EventEmitterToken |
onConnectionChanged(boolean isConnected,
T nc,
@Nullable ConnectionManager.EventEmitterToken token)
The connection state of the network context changed, notify all listeners
|
public void addListener(@NotNull
@NotNull ConnectionManager.ConnectionListener<T> connectionListener)
public void executeNewListeners(@NotNull
T nc,
@NotNull
@NotNull ConnectionManager.EventEmitterToken token)
nc - The network context of the emittertoken - The event emitter tokenpublic ConnectionManager.EventEmitterToken onConnectionChanged(boolean isConnected, @NotNull T nc, @Nullable @Nullable ConnectionManager.EventEmitterToken token)
Idempotent if the same emitter calls with the same state consecutively.
isConnected - The new connection statenc - The network contexttoken - The event emitter token, or null if the event emitter is newCopyright © 2023. All rights reserved.