Class SessionManagerClustered

    • Field Detail

      • CLUSTER_STRATEGY_VAR

        public static final java.lang.String CLUSTER_STRATEGY_VAR
        See Also:
        Constant Field Values
      • MY_DOMAIN_NAME_PROP_KEY

        public static final java.lang.String MY_DOMAIN_NAME_PROP_KEY
        See Also:
        Constant Field Values
      • STRATEGY_CLASS_PROP_KEY

        public static final java.lang.String STRATEGY_CLASS_PROP_KEY
        See Also:
        Constant Field Values
      • STRATEGY_CLASS_PROP_VAL

        public static final java.lang.String STRATEGY_CLASS_PROP_VAL
        See Also:
        Constant Field Values
      • STRATEGY_CLASS_PROPERTY

        public static final java.lang.String STRATEGY_CLASS_PROPERTY
        See Also:
        Constant Field Values
    • Constructor Detail

      • SessionManagerClustered

        public SessionManagerClustered()
    • Method Detail

      • containsJid

        public boolean containsJid​(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 AbstractMessageReceiver
      • initBindings

        public void initBindings​(javax.script.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.
      • 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
      • getConnectionIdsForJid

        public JID[] getConnectionIdsForJid​(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 java.lang.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.
      • 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.