Class ACMSessionDistributionHelper


  • public class ACMSessionDistributionHelper
    extends java.lang.Object
    ACMSessionDistributionHelper is a collection of methods to help decide where to create the sessions in the Intelligence Server Cluster
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.String,​java.lang.String> getActiveProjectsOnNode​(com.microstrategy.webapi.CDSSXMLClusterNode iClusterNode)
      Get the active projects on a Node.
      static <TClusterNode extends IDSSXMLClusterNode>
      java.util.Collection<TClusterNode>
      getAllAliveNodesInCluster​(com.microstrategy.webapi.CDSSXMLClusterNode iClusterNode)
      getAllAliveNodesInCluster returns all the currently alive nodes in the cluster.
      static <TClusterNode extends IDSSXMLClusterNode>
      java.util.List<TClusterNode>
      getAllAliveNodesInCluster​(IDSSXMLServerSession iServerSession)
      getAllAliveNodesInCluster returns all the currently alive nodes in the cluster.
      static <TClusterNode extends IDSSXMLClusterNode>
      java.util.List<TClusterNode>
      getAllAliveNodesInCluster​(java.lang.String iNodeName, int iPort)
      getAllAliveNodesInCluster returns all the currently alive nodes in the cluster.
      static java.util.Collection<java.lang.String> getCommonElements​(java.util.Collection<java.lang.String> iPids1, java.util.Collection<java.lang.String> iPids2)
      getCommonElements return the common elements in two collections
      static com.microstrategy.webapi.CDSSXMLClusterNode getNodeLeastAdjustLoad​(java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iClusterNodes)
      Get the node with least adjust node in the collection of cluster nodes.
      Guaranteed to not be null.
      static <TClusterNode extends IDSSXMLClusterNode>
      java.util.Map<TClusterNode,​java.util.Collection<java.lang.String>>
      getNodeProjectsForCrossProjectOperations​(IDSSXMLSessionId.IMasterSessionId iMasterSessionId, java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iClusterNodes, java.util.Collection<java.lang.String> iPids, boolean useFence)
      Get the node and the projects on the node for cross project operations
      static <TClusterNode extends IDSSXMLClusterNode>
      java.util.List<TClusterNode>
      getNodesLoadedProject​(java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iClusterNodes, java.lang.String iPid)
      getNodesLoadedProject returns the list of nodes loaded with the project and the project is active.
      <TClusterNode extends IDSSXMLClusterNode>
      java.util.List<TClusterNode>
      getNodesToConnectForProject​(IDSSXMLSessionId.IMasterSessionId iMasterSessionId, java.lang.String iProjectID, java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iClusterNodes, boolean iUseFence, java.util.Optional<java.util.HashSet<com.microstrategy.webapi.ACMClusterMapKey.Key>> iNodesToExclude)
      getNodesToConnectForProject returns the sorted list of nodes able to create the project sessions.
      static java.util.Map<java.lang.String,​java.lang.String> getUniqueActiveProjectsInNodes​(java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iClusterNodes)
      Get the unique projects in the collection of cluster nodes
      static boolean getUserAffinityFlag()
      getUserAffinityFlag return the user affinity flag specified in IServer server definition
      static com.microstrategy.webapi.ACMProjectFenceTierCache.ProjectFenceTiers getUserProjectsFenceTierWithFencing​(java.lang.String iUserL, IDSSXMLSessionId iSessionId, java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iNodesInCluster)
      getUserProjectsFenceTier gets all the fencing tiers for all the IServers for the user, if fencing is on.
      static com.microstrategy.webapi.ACMProjectFenceTierCache.ProjectFenceTiers getUserProjectsFenceTierWithoutFencing​(java.lang.String iUserL, java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iNodesInCluster)  
      static com.microstrategy.webapi.CDSSXMLCluster RefreshClusterMembershipEx​(java.lang.String iNodeName, int iPort)
      RefreshClusterMembershipEx finds the cluster that the input connectivity info corresponds to.
      static <TClusterNode extends IDSSXMLClusterNode>
      java.util.List<TClusterNode>
      sortNodeLeastAdjustedLoadMaxActiveProjects​(java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iClusterNodes, java.util.Optional<java.lang.String> iProjectIdOpt)
      sortNodeLeastAdjustedLoadMaxActiveProjects filters out nodes that don't have the iProjectIdOpt, then sorts the nodes by primary key least-to-most adjusted load, then secondary key most-to-least active projects (that are not idle).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ACMSessionDistributionHelper

        public ACMSessionDistributionHelper()
    • Method Detail

      • getUserAffinityFlag

        public static boolean getUserAffinityFlag()
        getUserAffinityFlag return the user affinity flag specified in IServer server definition
        Returns:
      • getUserProjectsFenceTierWithoutFencing

        public static com.microstrategy.webapi.ACMProjectFenceTierCache.ProjectFenceTiers getUserProjectsFenceTierWithoutFencing​(java.lang.String iUserL,
                                                                                                                                 java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iNodesInCluster)
                                                                                                                          throws MSTRWebAPIException
        Throws:
        MSTRWebAPIException
      • getUserProjectsFenceTierWithFencing

        public static com.microstrategy.webapi.ACMProjectFenceTierCache.ProjectFenceTiers getUserProjectsFenceTierWithFencing​(java.lang.String iUserL,
                                                                                                                              IDSSXMLSessionId iSessionId,
                                                                                                                              java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iNodesInCluster)
                                                                                                                       throws MSTRWebAPIException
        getUserProjectsFenceTier gets all the fencing tiers for all the IServers for the user, if fencing is on. If fencing is off then all IServers will be returned with tier 0. Guaranteed to not return null. May return an empty collection
        Parameters:
        iUserL -
        iConfigSession -
        iNodesInCluster -
        Returns:
        Throws:
        MSTRWebAPIException
      • getUniqueActiveProjectsInNodes

        public static java.util.Map<java.lang.String,​java.lang.String> getUniqueActiveProjectsInNodes​(java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iClusterNodes)
                                                                                                     throws MSTRWebAPIException
        Get the unique projects in the collection of cluster nodes
        Parameters:
        iClusterNodes -
        Returns:
        Throws:
        MSTRWebAPIException
      • getNodeLeastAdjustLoad

        public static com.microstrategy.webapi.CDSSXMLClusterNode getNodeLeastAdjustLoad​(java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iClusterNodes)
                                                                                  throws MSTRWebAPIException
        Get the node with least adjust node in the collection of cluster nodes.
        Guaranteed to not be null. May be empty if the input iClusterNodes is empty.
        Parameters:
        iClusterNodes -
        Returns:
        Throws:
        MSTRWebAPIException
      • getActiveProjectsOnNode

        public static java.util.Map<java.lang.String,​java.lang.String> getActiveProjectsOnNode​(com.microstrategy.webapi.CDSSXMLClusterNode iClusterNode)
        Get the active projects on a Node. The key is on Project ID, the value is on Project Name. The map is guaranteed to not be null but can be empty
        Parameters:
        iClusterNode -
        Returns:
      • getNodesToConnectForProject

        public <TClusterNode extends IDSSXMLClusterNode> java.util.List<TClusterNode> getNodesToConnectForProject​(IDSSXMLSessionId.IMasterSessionId iMasterSessionId,
                                                                                                                  java.lang.String iProjectID,
                                                                                                                  java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iClusterNodes,
                                                                                                                  boolean iUseFence,
                                                                                                                  java.util.Optional<java.util.HashSet<com.microstrategy.webapi.ACMClusterMapKey.Key>> iNodesToExclude)
                                                                                                           throws MSTRWebAPIException
        getNodesToConnectForProject returns the sorted list of nodes able to create the project sessions. The list is sorted in order of most desired
        Parameters:
        iMasterSessionId -
        iProjectID -
        Returns:
        Throws:
        MSTRWebAPIException
      • getNodeProjectsForCrossProjectOperations

        public static <TClusterNode extends IDSSXMLClusterNode> java.util.Map<TClusterNode,​java.util.Collection<java.lang.String>> getNodeProjectsForCrossProjectOperations​(IDSSXMLSessionId.IMasterSessionId iMasterSessionId,
                                                                                                                                                                                  java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iClusterNodes,
                                                                                                                                                                                  java.util.Collection<java.lang.String> iPids,
                                                                                                                                                                                  boolean useFence)
                                                                                                                                                                           throws MSTRWebAPIException
        Get the node and the projects on the node for cross project operations
        Parameters:
        iMasterSessionId - - master session id for the cross project operations
        iClusterNodes - - the collection of nodes to allocate
        iPids - - the collection of projects to allocate
        Returns:
        Throws:
        MSTRWebAPIException
      • getCommonElements

        public static java.util.Collection<java.lang.String> getCommonElements​(java.util.Collection<java.lang.String> iPids1,
                                                                               java.util.Collection<java.lang.String> iPids2)
        getCommonElements return the common elements in two collections
        Parameters:
        iPids1 -
        iPids2 -
        Returns:
      • getNodesLoadedProject

        public static <TClusterNode extends IDSSXMLClusterNode> java.util.List<TClusterNode> getNodesLoadedProject​(java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iClusterNodes,
                                                                                                                   java.lang.String iPid)
                                                                                                            throws MSTRWebAPIException
        getNodesLoadedProject returns the list of nodes loaded with the project and the project is active. The order of the list is retained from the input iClusterNodes. The list is guaranteed to not be null, but may be empty
        Parameters:
        iClusterNodes -
        iPid -
        Returns:
        Throws:
        MSTRWebAPIException
      • sortNodeLeastAdjustedLoadMaxActiveProjects

        public static <TClusterNode extends IDSSXMLClusterNode> java.util.List<TClusterNode> sortNodeLeastAdjustedLoadMaxActiveProjects​(java.util.Collection<com.microstrategy.webapi.CDSSXMLClusterNode> iClusterNodes,
                                                                                                                                        java.util.Optional<java.lang.String> iProjectIdOpt)
                                                                                                                                 throws MSTRWebAPIException
        sortNodeLeastAdjustedLoadMaxActiveProjects filters out nodes that don't have the iProjectIdOpt, then sorts the nodes by primary key least-to-most adjusted load, then secondary key most-to-least active projects (that are not idle). If multiple nodes have the same number of active projects, the sub-order is undefined.
        Parameters:
        iClusterNodes -
        Returns:
        Throws:
        MSTRWebAPIException
      • getAllAliveNodesInCluster

        public static <TClusterNode extends IDSSXMLClusterNode> java.util.List<TClusterNode> getAllAliveNodesInCluster​(IDSSXMLServerSession iServerSession)
                                                                                                                throws MSTRWebAPIException
        getAllAliveNodesInCluster returns all the currently alive nodes in the cluster. The cluster is found even if the input iServerSession represents a node that is currently down. The collection is guaranteed to not be null but may be empty.
        Parameters:
        iServerSession -
        Returns:
        Throws:
        MSTRWebAPIException
      • getAllAliveNodesInCluster

        public static <TClusterNode extends IDSSXMLClusterNode> java.util.Collection<TClusterNode> getAllAliveNodesInCluster​(com.microstrategy.webapi.CDSSXMLClusterNode iClusterNode)
                                                                                                                      throws MSTRWebAPIException
        getAllAliveNodesInCluster returns all the currently alive nodes in the cluster. The cluster is found even if the input iNode represents a node that is currently down. The collection is guaranteed to not be null but may be empty
        Parameters:
        iClusterNode -
        Returns:
        Throws:
        MSTRWebAPIException
      • getAllAliveNodesInCluster

        public static <TClusterNode extends IDSSXMLClusterNode> java.util.List<TClusterNode> getAllAliveNodesInCluster​(java.lang.String iNodeName,
                                                                                                                       int iPort)
                                                                                                                throws MSTRWebAPIException
        getAllAliveNodesInCluster returns all the currently alive nodes in the cluster. The cluster is found even if the input iNodeName/iPort represents a node that is currently down. The collection is guaranteed to not be null but may be empty
        Parameters:
        iNodeName -
        Returns:
        Throws:
        MSTRWebAPIException
      • RefreshClusterMembershipEx

        public static com.microstrategy.webapi.CDSSXMLCluster RefreshClusterMembershipEx​(java.lang.String iNodeName,
                                                                                         int iPort)
                                                                                  throws MSTRWebAPIException
        RefreshClusterMembershipEx finds the cluster that the input connectivity info corresponds to. Then it ensures that the RefreshClusterMembership is called on a live machine. It does this by trying them in turn until success. If no machines are alive, then a MSTRWebAPIException is thrown
        Parameters:
        iNodeName - A node name, ip address, or IServer's reported name to use to find the cluster
        iPort - The port used to find the cluster
        Returns:
        CDSSXMLCluster guaranteed to not be null
        Throws:
        MSTRWebAPIException