Class ConnectionMultiplexerManager

java.lang.Object
org.jivesoftware.openfire.multiplex.ConnectionMultiplexerManager
All Implemented Interfaces:
SessionEventListener

public class ConnectionMultiplexerManager extends Object implements SessionEventListener
A ConnectionMultiplexerManager is responsible for keeping track of the connected Connection Managers and the sessions that were established with the Connection Managers. Moreover, a ConnectionMultiplexerManager is able to create, get and close client sessions based on Connection requests.
Author:
Gaston Dombiak
  • Method Details

    • getInstance

      public static ConnectionMultiplexerManager getInstance()
      Returns the unique instance of this class.
      Returns:
      the unique instance of this class.
    • getDefaultSecret

      public static String getDefaultSecret()
      Returns the default secret key that connection managers should present while trying to establish a new connection.
      Returns:
      the default secret key that connection managers should present while trying to establish a new connection.
    • setDefaultSecret

      public static void setDefaultSecret(String defaultSecret)
      Sets the default secret key that connection managers should present while trying to establish a new connection.
      Parameters:
      defaultSecret - the default secret key that connection managers should present while trying to establish a new connection.
    • createClientSession

      public boolean createClientSession(String connectionManagerDomain, StreamID streamID, String hostName, String hostAddress)
      Creates a new client session that was established to the specified connection manager. The new session will not be findable through its stream ID.
      Parameters:
      connectionManagerDomain - the connection manager that is handling the connection of the session.
      streamID - the stream ID created by the connection manager for the new session.
      hostName - the address's hostname of the client or null if using old connection manager.
      hostAddress - the textual representation of the address of the client or null if using old CM.
      Returns:
      true if a session was created or false if the client should disconnect.
    • closeClientSession

      public void closeClientSession(String connectionManagerDomain, StreamID streamID)
      Closes an existing client session that was established through a connection manager.
      Parameters:
      connectionManagerDomain - the connection manager that is handling the connection of the session.
      streamID - the stream ID created by the connection manager for the session.
    • multiplexerAvailable

      public void multiplexerAvailable(String connectionManagerName)
      A connection manager has become available. Clients can now connect to the server through the connection manager.
      Parameters:
      connectionManagerName - the connection manager that has become available.
    • multiplexerUnavailable

      public void multiplexerUnavailable(String connectionManagerName)
      A connection manager has gone unavailable. Close client sessions that were established to the specified connection manager.
      Parameters:
      connectionManagerName - the connection manager that is no longer available.
    • getClientSession

      public LocalClientSession getClientSession(String connectionManagerDomain, StreamID streamID)
      Returns the ClientSession with the specified stream ID that is being hosted by the specified connection manager.
      Parameters:
      connectionManagerDomain - the connection manager that is handling the connection of the session.
      streamID - the stream ID created by the connection manager for the session.
      Returns:
      the ClientSession with the specified stream ID.
    • getMultiplexerSession

      public ConnectionMultiplexerSession getMultiplexerSession(String connectionManagerDomain, StreamID streamID)
      Returns a ConnectionMultiplexerSession for the specified connection manager domain or null if none was found. If a StreamID is passed in, the same connection will always be used for that StreamID. Otherwise, if the connection manager has many connections established with the server then one of them will be selected randomly.
      Parameters:
      connectionManagerDomain - the domain of the connection manager to get a session.
      streamID - if provided, the same connection will always be used for a given streamID
      Returns:
      a session to the specified connection manager domain or null if none was found.
    • getMultiplexerSession

      public ConnectionMultiplexerSession getMultiplexerSession(String connectionManagerDomain)
      Returns a ConnectionMultiplexerSession for the specified connection manager domain or null if none was found. In case the connection manager has many connections established with the server then one of them will be selected randomly.
      Parameters:
      connectionManagerDomain - the domain of the connection manager to get a session.
      Returns:
      a session to the specified connection manager domain or null if none was found.
    • getMultiplexers

      public Collection<String> getMultiplexers()
      Returns the names of the connected connection managers to this server.
      Returns:
      the names of the connected connection managers to this server.
    • getNumConnectedClients

      public int getNumConnectedClients(String managerName)
      Returns the number of connected clients to a specific connection manager.
      Parameters:
      managerName - the name of the connection manager.
      Returns:
      the number of connected clients to a specific connection manager.
    • anonymousSessionCreated

      public void anonymousSessionCreated(Session session)
      Description copied from interface: SessionEventListener
      Notification event indicating that an anonymous user has authenticated with the server.
      Specified by:
      anonymousSessionCreated in interface SessionEventListener
      Parameters:
      session - the authenticated session of an anonymous user.
    • anonymousSessionDestroyed

      public void anonymousSessionDestroyed(Session session)
      Description copied from interface: SessionEventListener
      An authenticated session of an anonymous user was destroyed.
      Specified by:
      anonymousSessionDestroyed in interface SessionEventListener
      Parameters:
      session - the authenticated session of an anonymous user.
    • sessionCreated

      public void sessionCreated(Session session)
      Description copied from interface: SessionEventListener
      Notification event indicating that a user has authenticated with the server. The authenticated user is not an anonymous user.
      Specified by:
      sessionCreated in interface SessionEventListener
      Parameters:
      session - the authenticated session of a non anonymous user.
    • sessionDestroyed

      public void sessionDestroyed(Session session)
      Description copied from interface: SessionEventListener
      An authenticated session of a non anonymous user was destroyed.
      Specified by:
      sessionDestroyed in interface SessionEventListener
      Parameters:
      session - the authenticated session of a non anonymous user.
    • resourceBound

      public void resourceBound(Session session)
      Description copied from interface: SessionEventListener
      A session has finished resource binding.
      Specified by:
      resourceBound in interface SessionEventListener
      Parameters:
      session - the session on which resource binding was performed.