psdi.server

Class MaxSession

  • java.lang.Object
    • psdi.server.MaxSession


  • public class MaxSession
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor and Description
      MaxSession() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static void addServerToMaxSession(java.sql.Connection con, long sessionId, java.lang.String userId, java.lang.String serverHost, java.lang.String serverName, int tenantId)
      Adds an entry for the server in MaxSession table
      static void deleteAllRowsForServer(java.sql.Connection con, java.lang.String serverName, java.lang.String serverHost)
      Delete all the rows for the server.
      static java.util.Vector getAllServerNames(java.sql.Connection con)
      Get name,host and sessionid for all servers
      static java.util.Vector getAllServerNamesWithTimestamp(java.sql.Connection con)
      Get name,host and sessionid for all servers
      static java.util.Vector getAllServersInfo(java.sql.Connection con)
      Get name,host and sessionid for all servers
      static java.util.List getAllTeanants(java.sql.Connection con)
      Get name,host and sessionid for all servers
      static java.util.Map getAllTenantsServerInfo(java.sql.Connection con, java.lang.String serverHost, java.lang.String serverName)
      Get name,host and sessionid for server
      static java.lang.String getNewReloadCacheForOwnerServer(java.lang.String dbReloadCache, java.lang.String cacheName)
      Get the new reloadcache value
      static java.lang.String getServerInfo(java.sql.Connection con, java.lang.String serverHost, java.lang.String serverName)
      Get name,host and sessionid for server
      static java.util.List getTenantList(java.sql.Connection con, java.lang.String serverName, java.lang.String serverHost)
      Get name,host and sessionid for server
      static void removeDeadTenantSession(java.sql.Connection con)
      Remove server session rows if server is not running for 60 min.
      static void unlockRecords(java.sql.Connection con, java.lang.String serverName, java.lang.String serverHost) 
      static int updateExecute(java.sql.Connection con, java.lang.String serverHost, java.lang.String serverName, java.lang.String newCacheValue, java.lang.String oldValue, boolean updateHeartbeat)
      Update tenantsession.reloadcache with new value.
      static void updateMaxSessionTimestamp(java.sql.Connection con, java.lang.String serverHost, java.lang.String serverName)
      Update maxsession.timestamp.
      static void updateReloadCache(java.sql.Connection con, java.lang.String serverName, java.lang.String serverHost, java.lang.String reload, boolean updateAllServers)
      Update the reload cache for the server.
      • Methods inherited from class java.lang.Object

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

      • MaxSession

        public MaxSession()
    • Method Detail

      • addServerToMaxSession

        public static void addServerToMaxSession(java.sql.Connection con,
                                                 long sessionId,
                                                 java.lang.String userId,
                                                 java.lang.String serverHost,
                                                 java.lang.String serverName,
                                                 int tenantId)
                                          throws MXException
        Adds an entry for the server in MaxSession table
        Parameters:
        con -
        sessionId - This parameter is not used.
        userId -
        serverHost -
        serverName -
        Throws:
        MXException
      • unlockRecords

        public static void unlockRecords(java.sql.Connection con,
                                         java.lang.String serverName,
                                         java.lang.String serverHost)
                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • removeDeadTenantSession

        public static void removeDeadTenantSession(java.sql.Connection con)
                                            throws java.lang.Exception
        Remove server session rows if server is not running for 60 min. or for the time specified in mxe.mt.tenantsessiontimeout property
        Parameters:
        con -
        Throws:
        java.lang.Exception
      • updateReloadCache

        public static void updateReloadCache(java.sql.Connection con,
                                             java.lang.String serverName,
                                             java.lang.String serverHost,
                                             java.lang.String reload,
                                             boolean updateAllServers)
                                      throws MXException
        Update the reload cache for the server.
        Parameters:
        con -
        serverName -
        serverHost -
        reload - the cache name that has just been reloaded on this server
        updateAllServers - True to update all other instances of MXServer, false to update only this instance. When true, maxsession.reloadcache is updated for the other instances with the names of cache to be reloaded.
        Throws:
        MXException
      • getAllTeanants

        public static java.util.List getAllTeanants(java.sql.Connection con)
                                             throws MXException
        Get name,host and sessionid for all servers
        Parameters:
        con -
        Throws:
        MXException
      • getAllServerNamesWithTimestamp

        public static java.util.Vector getAllServerNamesWithTimestamp(java.sql.Connection con)
                                                               throws MXException
        Get name,host and sessionid for all servers
        Parameters:
        con -
        Throws:
        MXException
      • getAllServerNames

        public static java.util.Vector getAllServerNames(java.sql.Connection con)
                                                  throws MXException
        Get name,host and sessionid for all servers
        Parameters:
        con -
        Throws:
        MXException
      • getAllServersInfo

        public static java.util.Vector getAllServersInfo(java.sql.Connection con)
                                                  throws MXException
        Get name,host and sessionid for all servers
        Parameters:
        con -
        Throws:
        MXException
      • getServerInfo

        public static java.lang.String getServerInfo(java.sql.Connection con,
                                                     java.lang.String serverHost,
                                                     java.lang.String serverName)
                                              throws MXException
        Get name,host and sessionid for server
        Parameters:
        con -
        Throws:
        MXException
      • getAllTenantsServerInfo

        public static java.util.Map getAllTenantsServerInfo(java.sql.Connection con,
                                                            java.lang.String serverHost,
                                                            java.lang.String serverName)
                                                     throws MXException
        Get name,host and sessionid for server
        Parameters:
        con -
        Throws:
        MXException
      • getTenantList

        public static java.util.List getTenantList(java.sql.Connection con,
                                                   java.lang.String serverName,
                                                   java.lang.String serverHost)
                                            throws MXException
        Get name,host and sessionid for server
        Parameters:
        con -
        Throws:
        MXException
      • getNewReloadCacheForOwnerServer

        public static java.lang.String getNewReloadCacheForOwnerServer(java.lang.String dbReloadCache,
                                                                       java.lang.String cacheName)
        Get the new reloadcache value
        Parameters:
        dbReloadCache -
        cacheName -
        Returns:
        reloadcache value
      • updateExecute

        public static int updateExecute(java.sql.Connection con,
                                        java.lang.String serverHost,
                                        java.lang.String serverName,
                                        java.lang.String newCacheValue,
                                        java.lang.String oldValue,
                                        boolean updateHeartbeat)
                                 throws java.lang.Exception
        Update tenantsession.reloadcache with new value. The update statement needs to qualify by the old value, if the old value passed in is not what in the database anymore, the query should return 0.
        Parameters:
        con -
        serverHost -
        serverName -
        newCacheValue -
        updateHeartbeat - True to update maxsession.servertimestamp, else False. This should be true only if we're updating our own server.
        Throws:
        java.lang.Exception
      • updateMaxSessionTimestamp

        public static void updateMaxSessionTimestamp(java.sql.Connection con,
                                                     java.lang.String serverHost,
                                                     java.lang.String serverName)
                                              throws java.lang.Exception
        Update maxsession.timestamp.
        Parameters:
        con -
        serverHost -
        serverName -
        Throws:
        java.lang.Exception