public abstract class ClusterContext extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CLUSTER_CONTEXT
ClusterContext registration property.
|
Constructor and Description |
---|
ClusterContext() |
Modifier and Type | Method and Description |
---|---|
abstract void |
broadcastBinary(String endpointPath,
byte[] data)
Broadcast binary message.
|
abstract void |
broadcastText(String endpointPath,
String text)
Broadcast text message.
|
abstract Future<Void> |
close(String sessionId)
Close remote session.
|
abstract Future<Void> |
close(String sessionId,
javax.websocket.CloseReason closeReason)
Close remote session with custom
CloseReason . |
abstract String |
createConnectionId()
Create connection id.
|
abstract String |
createSessionId()
Create session id.
|
abstract void |
destroyDistributedUserProperties(String connectionId)
Destroy map which holds distributed user properties.
|
abstract Map<RemoteSession.DistributedMapKey,Object> |
getDistributedSessionProperties(String sessionId)
Get the map containing session properties to be shared among nodes.
|
abstract Map<String,Object> |
getDistributedUserProperties(String connectionId)
Get the map containing session user properties to be shared among nodes.
|
abstract Set<String> |
getRemoteSessionIds(String endpointPath)
Get set containing session ids of all remote sessions registered to given endpoint path.
|
abstract boolean |
isSessionOpen(String sessionId,
String endpointPath)
Get information about session state.
|
abstract void |
registerBroadcastListener(String endpointPath,
BroadcastListener listener)
Register broadcast listener.
|
abstract void |
registerSession(String sessionId,
String endpointPath,
SessionEventListener listener)
Register local session.
|
abstract void |
registerSessionListener(String endpointPath,
SessionListener listener)
Register session listener.
|
abstract void |
removeSession(String sessionId,
String endpointPath)
Remove session from this Cluster context.
|
abstract Future<Void> |
sendBinary(String sessionId,
byte[] data)
Send binary message.
|
abstract Future<Void> |
sendBinary(String sessionId,
byte[] data,
boolean isLast)
Send partial binary message.
|
abstract void |
sendBinary(String sessionId,
byte[] data,
javax.websocket.SendHandler sendHandler)
Send binary message with
SendHandler . |
abstract Future<Void> |
sendPing(String sessionId,
byte[] data)
Send ping message.
|
abstract Future<Void> |
sendPong(String sessionId,
byte[] data)
Send pong message.
|
abstract Future<Void> |
sendText(String sessionId,
String text)
Send text message.
|
abstract Future<Void> |
sendText(String sessionId,
String text,
boolean isLast)
Send partial text message.
|
abstract void |
sendText(String sessionId,
String text,
javax.websocket.SendHandler sendHandler)
Send text message with
SendHandler . |
abstract void |
shutdown()
Shutdown this ClusterContext.
|
public static final String CLUSTER_CONTEXT
ServerContainerFactory.createServerContainer(java.util.Map)
.public abstract Future<Void> sendText(String sessionId, String text)
sessionId
- remote session id.text
- text to be sent.Future.get()
returns when there is an
acknowledge from the other node that the message has been successfully sent. If there is any exception, it will
be wrapped into ExecutionException
and thrown.public abstract Future<Void> sendText(String sessionId, String text, boolean isLast)
sessionId
- remote session id.text
- text to be sent.isLast
- true
when the partial message being sent is the last part of the message.Future.get()
returns when there is an
acknowledge from the other node that the message has been successfully sent. If there is any exception, it will
be wrapped into ExecutionException
and thrown.public abstract Future<Void> sendBinary(String sessionId, byte[] data)
sessionId
- remote session id.data
- data to be sent.Future.get()
returns when there is an
acknowledge from the other node that the message has been successfully sent. If there is any exception, it will
be wrapped into ExecutionException
and thrown.public abstract Future<Void> sendBinary(String sessionId, byte[] data, boolean isLast)
sessionId
- remote session id.data
- data to be sent.isLast
- true
when the partial message being sent is the last part of the message.Future.get()
returns when there is an
acknowledge from the other node that the message has been successfully sent. If there is any exception, it will
be wrapped into ExecutionException
and thrown.public abstract Future<Void> sendPing(String sessionId, byte[] data)
sessionId
- remote session id.data
- data to be sent as ping message payload.Future.get()
returns when there is an
acknowledge from the other node that the message has been successfully sent. If there is any exception, it will
be wrapped into ExecutionException
and thrown.public abstract Future<Void> sendPong(String sessionId, byte[] data)
sessionId
- remote session id.data
- data to be sent as pong message payload.Future.get()
returns when there is an
acknowledge from the other node that the message has been successfully sent. If there is any exception, it will
be wrapped into ExecutionException
and thrown.public abstract void sendText(String sessionId, String text, javax.websocket.SendHandler sendHandler)
SendHandler
.sessionId
- remote session id.text
- text to be sent.sendHandler
- sendhandler instance on which
SendHandler.onResult(javax.websocket.SendResult)
will be invoked.SendHandler
public abstract void sendBinary(String sessionId, byte[] data, javax.websocket.SendHandler sendHandler)
SendHandler
.sessionId
- remote session id.data
- data to be sent.sendHandler
- sendhandler instance on which
SendHandler.onResult(javax.websocket.SendResult)
will be invoked.SendHandler
public abstract void broadcastText(String endpointPath, String text)
endpointPath
- endpoint path identifying sessions alignment to the endpoint.text
- message to be broadcasted.public abstract void broadcastBinary(String endpointPath, byte[] data)
endpointPath
- endpoint path identifying sessions alignment to the endpoint.data
- data to be broadcasted.public abstract boolean isSessionOpen(String sessionId, String endpointPath)
sessionId
- remote session id.endpointPath
- endpoint path identifying sessions alignment to the endpoint.true
when session is opened, false
otherwise.Session.isOpen()
public abstract Future<Void> close(String sessionId)
sessionId
- remote session id.Future.get()
returns when there is an
acknowledge from the other node that the command was successfully executed. If there is any exception, it will
be
wrapped into ExecutionException
and thrown.public abstract Future<Void> close(String sessionId, javax.websocket.CloseReason closeReason)
CloseReason
.sessionId
- remote session id.closeReason
- custom close reason.Future.get()
returns when there is an
acknowledge from the other node that the command was successfully executed. If there is any exception, it will
be
wrapped into ExecutionException
and thrown.public abstract Set<String> getRemoteSessionIds(String endpointPath)
endpointPath
- endpoint path identifying endpoint within the cluster.public abstract String createSessionId()
public abstract String createConnectionId()
public abstract void registerSession(String sessionId, String endpointPath, SessionEventListener listener)
getDistributedSessionProperties(String)
and process its values. The map must be ready before this method is invoked.sessionId
- session id to be registered.endpointPath
- endpoint path identifying sessions alignment to the endpoint.listener
- session event listener. When remote node sends a message to this session, it will be
invoked.SessionEventListener
public abstract void registerSessionListener(String endpointPath, SessionListener listener)
.SessionListener#onSessionOpened(String)
and destruction .SessionListener#onSessionClosed(String)
.endpointPath
- endpoint path identifying sessions alignment to the endpoint.listener
- listener instance.SessionListener
public abstract void registerBroadcastListener(String endpointPath, BroadcastListener listener)
n
when n
represent
number of clients connected to remote nodes).endpointPath
- endpoint path identifying sessions alignment to the endpoint.listener
- listener instance.BroadcastListener
public abstract Map<RemoteSession.DistributedMapKey,Object> getDistributedSessionProperties(String sessionId)
sessionId
- remote session id.public abstract Map<String,Object> getDistributedUserProperties(String connectionId)
connectionId
- connection id. Connection id may be shared among subsequent TCP connection - represents
logical connection.public abstract void destroyDistributedUserProperties(String connectionId)
connectionId
- connection id. Connection id may be shared among subsequent TCP connection - represents
logical connection.public abstract void removeSession(String sessionId, String endpointPath)
sessionId
- session id.endpointPath
- endpoint path identifying sessions alignment to the endpoint.public abstract void shutdown()
Copyright © 2012-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.