org.apache.wicket.protocol.ws.api
Class SimpleWebSocketConnectionRegistry

java.lang.Object
  extended by org.apache.wicket.protocol.ws.api.SimpleWebSocketConnectionRegistry
All Implemented Interfaces:
IWebSocketConnectionRegistry

public class SimpleWebSocketConnectionRegistry
extends Object
implements IWebSocketConnectionRegistry

A registry that keeps all currently opened web socket connections in maps in Application's meta data. TODO remove the synchronizations below and use ConcurrentMap#putIfAbsent()

Since:
6.0

Constructor Summary
SimpleWebSocketConnectionRegistry()
           
 
Method Summary
 IWebSocketConnection getConnection(Application application, String sessionId, Integer pageId)
           
 Collection<IWebSocketConnection> getConnections(Application application)
          Returns a collection of currently active websockets.
 void removeConnection(Application application, String sessionId, Integer pageId)
          Removes a web socket connection from the registry at the specified coordinates (application+session+page)
 void setConnection(Application application, String sessionId, Integer pageId, IWebSocketConnection connection)
          Adds a new connection into the registry at the specified coordinates (application+session+page)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleWebSocketConnectionRegistry

public SimpleWebSocketConnectionRegistry()
Method Detail

getConnection

public IWebSocketConnection getConnection(Application application,
                                          String sessionId,
                                          Integer pageId)
Specified by:
getConnection in interface IWebSocketConnectionRegistry
Parameters:
application - the web application to look in
sessionId - the web socket client session id
pageId - the web socket client page id
Returns:
the web socket connection used by a client from the specified coordinates

getConnections

public Collection<IWebSocketConnection> getConnections(Application application)
Returns a collection of currently active websockets. The connections might close at any time.

Specified by:
getConnections in interface IWebSocketConnectionRegistry
Parameters:
application -
Returns:

setConnection

public void setConnection(Application application,
                          String sessionId,
                          Integer pageId,
                          IWebSocketConnection connection)
Description copied from interface: IWebSocketConnectionRegistry
Adds a new connection into the registry at the specified coordinates (application+session+page)

Specified by:
setConnection in interface IWebSocketConnectionRegistry
Parameters:
application - the web application to look in
sessionId - the web socket client session id
pageId - the web socket client page id
connection - the web socket connection to add

removeConnection

public void removeConnection(Application application,
                             String sessionId,
                             Integer pageId)
Description copied from interface: IWebSocketConnectionRegistry
Removes a web socket connection from the registry at the specified coordinates (application+session+page)

Specified by:
removeConnection in interface IWebSocketConnectionRegistry
Parameters:
application - the web application to look in
sessionId - the web socket client session id
pageId - the web socket client page id


Copyright © 2006–2013 Apache Software Foundation. All rights reserved.