public class WebSocketConnectionRegistry extends DestroyableBase
Organize websocket connection by string typed keys. Multiple connections can be attached to the same key
Destroyable.Util
logger
Constructor and Description |
---|
WebSocketConnectionRegistry() |
Modifier and Type | Method and Description |
---|---|
void |
accept(java.lang.String key,
org.osgl.Osgl.Function<WebSocketConnection,?> visitor)
Accept a visitor to iterate through the connections attached to the key specified
|
int |
count()
Returns the connection count in this registry.
|
int |
count(java.lang.String key)
Returns the connection count by key specified in this registry
|
void |
deRegister(java.lang.String key,
java.util.Collection<WebSocketConnection> connections)
De-register a group of connections from the registry by key
|
void |
deRegister(java.lang.String key,
WebSocketConnection connection)
De-register a connection from the registry by key specified
|
java.util.List<WebSocketConnection> |
get(java.lang.String key)
Return a list of websocket connection by key
|
void |
register(java.lang.String key,
java.util.Collection<WebSocketConnection> connections)
Sign in a group of web socket connections to the registry by key
|
void |
register(java.lang.String key,
WebSocketConnection connection)
Alias of
signIn(String, WebSocketConnection) |
protected void |
releaseResources() |
void |
signIn(java.lang.String key,
java.util.Collection<WebSocketConnection> connections)
Sign in a group of connections to the registry by key
|
void |
signIn(java.lang.String key,
WebSocketConnection connection)
Sign in a connection to the registry by key.
|
void |
signOff(java.lang.String key,
java.util.Collection<WebSocketConnection> connections)
Sign off a group of connections from the registry by key
|
void |
signOff(java.lang.String key,
WebSocketConnection connection) |
addSubResource, destroy, isDestroyed, reload, scope
debug, debug, error, error, fatal, fatal, info, info, isDebugEnabled, isTraceEnabled, trace, trace, warn, warn
public java.util.List<WebSocketConnection> get(java.lang.String key)
Return a list of websocket connection by key
key
- the key to find the websocket connection listpublic void accept(java.lang.String key, org.osgl.Osgl.Function<WebSocketConnection,?> visitor)
Accept a visitor to iterate through the connections attached to the key specified
key
- the keyvisitor
- the visitorpublic void register(java.lang.String key, WebSocketConnection connection)
Alias of signIn(String, WebSocketConnection)
Register a connection to the registry by key.
Note multiple connections can be attached to the same key
key
- the keyconnection
- the websocket connectionsignIn(String, WebSocketConnection)
public void signIn(java.lang.String key, WebSocketConnection connection)
Sign in a connection to the registry by key.
Note multiple connections can be attached to the same key
key
- the keyconnection
- the websocket connectionregister(String, WebSocketConnection)
public void register(java.lang.String key, java.util.Collection<WebSocketConnection> connections)
Sign in a group of web socket connections to the registry by key
key
- the keyconnections
- a collection of websocket connectionspublic void signIn(java.lang.String key, java.util.Collection<WebSocketConnection> connections)
Sign in a group of connections to the registry by key
key
- the keyconnections
- a collection of websocket connectionspublic void deRegister(java.lang.String key, WebSocketConnection connection)
De-register a connection from the registry by key specified
key
- the keyconnection
- the websocket connectionpublic void deRegister(java.lang.String key, java.util.Collection<WebSocketConnection> connections)
De-register a group of connections from the registry by key
Note this method is an alias of signOff(String, Collection)
key
- the keyconnections
- a collection of websocket connectionssignOff(String, Collection)
public void signOff(java.lang.String key, WebSocketConnection connection)
public void signOff(java.lang.String key, java.util.Collection<WebSocketConnection> connections)
Sign off a group of connections from the registry by key
key
- the keyconnections
- a collection of websocket connectionspublic int count()
Returns the connection count in this registry.
Note it might count connections that are closed but not removed from registry yet
public int count(java.lang.String key)
Returns the connection count by key specified in this registry
Note it might count connections that are closed but not removed from registry yet
key
- the keyprotected void releaseResources()
releaseResources
in class DestroyableBase
Copyright © 2014–2017 ActFramework. All rights reserved.