Class SessionManagerClustered

All Implemented Interfaces:
ClusteredComponentIfc, SessionManagerClusteredIfc, Configurable, XMPPService, ConfigurationChangedAware, Initializable, RegistrarBean, MessageReceiver, PacketWriterWithTimeout, ServerComponent, SessionManagerHandler, StatisticsContainer, StatisticsContainerIfc, OnlineJidsReporter, VHostListener

Class SessionManagerClusteredOld
Created: Tue Nov 22 07:07:11 2005
Author:
Artur Hefczyc
  • Field Details

  • Constructor Details

    • SessionManagerClustered

      public SessionManagerClustered()
  • Method Details

    • containsJid

      public boolean containsJid(tigase.xmpp.jid.BareJID jid)
      Description copied from interface: OnlineJidsReporter
      The method checks whether the given JID is known to the installation, either user connected to local machine or any of the cluster nodes. False result does not mean the user is not connected. It means the method does not know anything about the JID. Some clustering strategies may not cache online users information.
      Specified by:
      containsJid in interface OnlineJidsReporter
      Overrides:
      containsJid in class SessionManager
      Parameters:
      jid - a user's JID for whom we query information.
      Returns:
      true if the user is known as online to the installation, false if the method does not know.
    • everySecond

      public void everySecond()
      Description copied from class: AbstractMessageReceiver
      Utility method executed precisely every second. A component can overwrite the method to put own code to be executed at the regular intervals of time.
      Note, no extensive calculations should happen in this method nor long lasting operations. It is essential that the method processing does not exceed 1 second. The overriding method must call the the super method first and only then run own code.
      Overrides:
      everySecond in class SessionManager
    • everyMinute

      public void everyMinute()
      Description copied from class: AbstractMessageReceiver
      Utility method executed precisely every minute. A component can overwrite the method to put own code to be executed at the regular intervals of time.
      Note, no extensive calculations should happen in this method nor long lasting operations. It is essential that the method processing does not exceed 1 minute. The overriding method must call the the super method first and only then run own code.
      Overrides:
      everyMinute in class SessionManager
    • everyHour

      public void everyHour()
      Description copied from class: AbstractMessageReceiver
      Utility method executed precisely every hour. A component can overwrite the method to put own code to be executed at the regular intervals of time.
      Note, no extensive calculations should happen in this method nor long lasting operations. It is essential that the method processing does not exceed 1 hour. The overriding method must call the the super method first and only then run own code.
      Overrides:
      everyHour in class SessionManager
    • fastAddOutPacket

      public boolean fastAddOutPacket(Packet packet)
      Specified by:
      fastAddOutPacket in interface SessionManagerClusteredIfc
      Overrides:
      fastAddOutPacket in class SessionManager
    • handleLocalPacket

      public void handleLocalPacket(Packet packet, XMPPResourceConnection conn)
      Overrides:
      handleLocalPacket in class SessionManager
    • handleLogin

      public void handleLogin(tigase.xmpp.jid.BareJID userId, XMPPResourceConnection conn)
      Specified by:
      handleLogin in interface SessionManagerHandler
      Overrides:
      handleLogin in class SessionManager
    • handleLogout

      public void handleLogout(tigase.xmpp.jid.BareJID userId, XMPPResourceConnection conn)
      Specified by:
      handleLogout in interface SessionManagerHandler
      Overrides:
      handleLogout in class SessionManager
    • handleResourceBind

      public void handleResourceBind(XMPPResourceConnection conn)
      Specified by:
      handleResourceBind in interface SessionManagerHandler
      Overrides:
      handleResourceBind in class SessionManager
    • checkSingleUserConnectionsLimit

      protected void checkSingleUserConnectionsLimit(XMPPResourceConnection conn)
      Overrides:
      checkSingleUserConnectionsLimit in class SessionManager
    • initBindings

      public void initBindings(Bindings binds)
      Description copied from class: BasicComponent
      Initialize a mapping of key/value pairs which can be used in scripts loaded by the server
      Overrides:
      initBindings in class SessionManager
      Parameters:
      binds - A mapping of key/value pairs, all of whose keys are Strings.
    • onNodeConnected

      public void onNodeConnected(tigase.xmpp.jid.JID jid)
      Overrides:
      onNodeConnected in class BasicComponent
    • onNodeDisconnected

      public void onNodeDisconnected(tigase.xmpp.jid.JID jid)
      Overrides:
      onNodeDisconnected in class BasicComponent
    • processingInThreads

      public int processingInThreads()
      Description copied from class: AbstractMessageReceiver
      Concurrency control method. Returns preferable number of threads set for this component.
      Overrides:
      processingInThreads in class SessionManager
      Returns:
      preferable number of threads set for this component.
    • processingOutThreads

      public int processingOutThreads()
      Description copied from class: AbstractMessageReceiver
      Concurrency control method. Returns preferable number of threads set for this component.
      Overrides:
      processingOutThreads in class SessionManager
      Returns:
      preferable number of threads set for this component.
    • processPacket

      public void processPacket(Packet packet)
      This is the main Packet processing method. It is called concurrently from many threads so implementing it in thread save manner is essential. The method is called for each packet addressed to the component.
      Please note, the Packet instance may be processed by different parts of the server, different components or plugins at the same time. Therefore this is very important to tread the Packet instance as unmodifiable object.
      Processing in this method is asynchronous, therefore there is no result value. If there are some 'result' packets generated during processing, they should be passed back using addOutPacket(Packet) method.


      This is a standard component method for processing packets. The method takes care of cases where the packet cannot be processed locally, in such a case it is forwarded to another node.
      Overrides:
      processPacket in class SessionManager
      Parameters:
      packet - to be processed
    • processPacket

      public void processPacket(Packet packet, XMPPResourceConnection conn)
      Specified by:
      processPacket in interface SessionManagerClusteredIfc
      Overrides:
      processPacket in class SessionManager
    • processPresenceUpdate

      public void processPresenceUpdate(XMPPSession session, tigase.xml.Element packet)
      Specified by:
      processPresenceUpdate in interface SessionManagerClusteredIfc
      Overrides:
      processPresenceUpdate in class SessionManager
    • getComponentInfo

      public ComponentInfo getComponentInfo()
      Description copied from interface: ServerComponent
      Allows to obtain various informations about components
      Specified by:
      getComponentInfo in interface ServerComponent
      Overrides:
      getComponentInfo in class BasicComponent
      Returns:
      information about particular component
    • getConnectionIdsForJid

      public tigase.xmpp.jid.JID[] getConnectionIdsForJid(tigase.xmpp.jid.BareJID jid)
      Retrieve all connection IDs (CIDs) for the given user.
      If the installation knows about user's JID, that he is connected to the system, then this method returns all user's connection IDs. As an optimization we can forward packets to all user's connections directly from a single node.
      Specified by:
      getConnectionIdsForJid in interface OnlineJidsReporter
      Overrides:
      getConnectionIdsForJid in class SessionManager
      Parameters:
      jid - a user's JID for whom we query information.
      Returns:
      a list of all user's connection IDs.
    • getDiscoDescription

      public String getDiscoDescription()
      Description copied from class: BasicComponent
      Method returns description used for service discovery responses.
      Overrides:
      getDiscoDescription in class SessionManager
      Returns:
      description of a component
    • getStatistics

      public void getStatistics(StatisticsList list)
      Description copied from class: AbstractMessageReceiver
      Method returns component statistics. Please note, the method can be called every second by the server monitoring system therefore no extensive or lengthy calculations are allowed. If there are some statistics requiring lengthy operations like database access they must have Level.FINEST assigned and must be put inside the level guard to prevent generating them by the system monitor. The system monitor does not collect FINEST statistics.
      Level guard code looks like the example below:
       if (list.checkLevel(Level.FINEST)) {
         // Some CPU intensive calculations or lengthy operations
         list.add(getName(), "Statistic description", stat_value, Level.FINEST);
       }
      
       
      This way you make sure your extensive operation is not executed every second by the monitoring system and does not affect the server performance.
      Specified by:
      getStatistics in interface StatisticsContainerIfc
      Overrides:
      getStatistics in class SessionManager
      Parameters:
      list - is a StatistcsList where all statistics are stored.
    • getStrategy

      public ClusteringStrategyIfc getStrategy()
      Returns active clustering strategy object.
      Returns:
      active clustering strategy object.
    • getXMPPResourceConnection

      public XMPPResourceConnection getXMPPResourceConnection(Packet p)
      Specified by:
      getXMPPResourceConnection in interface SessionManagerClusteredIfc
      Overrides:
      getXMPPResourceConnection in class SessionManager
    • getXMPPResourceConnections

      public ConcurrentHashMap<tigase.xmpp.jid.JID,XMPPResourceConnection> getXMPPResourceConnections()
      Specified by:
      getXMPPResourceConnections in interface SessionManagerClusteredIfc
    • getXMPPSessions

      public ConcurrentHashMap<tigase.xmpp.jid.BareJID,XMPPSession> getXMPPSessions()
      Specified by:
      getXMPPSessions in interface SessionManagerClusteredIfc
    • hasCompleteJidsInfo

      public boolean hasCompleteJidsInfo()
      Description copied from interface: OnlineJidsReporter
      Method checks whether the clustering strategy has a complete JIDs info. That is whether the strategy knows about all users connected to all nodes. Some strategies may choose not to share this information among nodes, hence the methods returns false. Other may synchronize this information and can provide it to further optimize cluster traffic.
      Specified by:
      hasCompleteJidsInfo in interface OnlineJidsReporter
      Overrides:
      hasCompleteJidsInfo in class SessionManager
      Returns:
      a true boolean value if the strategy has a complete information about all users connected to all cluster nodes.
    • hasXMPPResourceConnectionForConnectionJid

      public boolean hasXMPPResourceConnectionForConnectionJid(tigase.xmpp.jid.JID connJid)
      Description copied from interface: SessionManagerClusteredIfc
      Method to check if there is XMPPResourceConnection instance for connection JID.
      Specified by:
      hasXMPPResourceConnectionForConnectionJid in interface SessionManagerClusteredIfc
      Returns:
      true - if there is XMPPResourceConnection for connection JID
    • setClusterController

      public void setClusterController(ClusterControllerIfc cl_controller)
      Description copied from interface: ClusteredComponentIfc
      Set's the configures the cluster controller object for cluster communication and API.
      Specified by:
      setClusterController in interface ClusteredComponentIfc
      Overrides:
      setClusterController in class BasicComponent
      Parameters:
      cl_controller - cluster controller object used for cluster communication
    • fillRoutedUserSessionWithProcessorResultWriter

      @FillRoutedEvent protected boolean fillRoutedUserSessionWithProcessorResultWriter(UserSessionEventWithProcessorResultWriter event)
    • fillRoutedUserSessionEvent

      @FillRoutedEvent protected boolean fillRoutedUserSessionEvent(UserSessionEvent event)
    • routeUserSessionEvent

      @RouteEvent protected Collection<Subscription> routeUserSessionEvent(UserSessionEvent event, Collection<Subscription> subscriptions)
    • closeSession

      protected void closeSession(XMPPResourceConnection conn, boolean closeOnly)
      The method intercept user's disconnect event. On user disconnect the method takes a list of cluster nodes from the strategy and sends a notification to all those nodes about the event.
      Overrides:
      closeSession in class SessionManager
      Parameters:
      conn - XMPPResourceConnection to be closed
      closeOnly - whether to perform additional processing before closing
      See Also:
    • xmppStreamMoved

      protected void xmppStreamMoved(XMPPResourceConnection conn, tigase.xmpp.jid.JID oldConnId, tigase.xmpp.jid.JID newConnId, String sendReponse)
      Overrides:
      xmppStreamMoved in class SessionManager