psdi.server

Class DBManager

  • java.lang.Object
    • psdi.server.DBManager
    • Field Detail

      • dbPropPrefix

        protected static final java.lang.String dbPropPrefix
        The property prefix for db
        See Also:
        Constant Field Values
      • defaultSchemaOwner

        protected static final java.lang.String defaultSchemaOwner
        See Also:
        Constant Field Values
      • name

        protected java.lang.String name
        The Datasource name, this is label users specify to get a connection from this pool.
      • urlString

        protected java.lang.String urlString
        Url of the database to connect to
      • free

        protected volatile java.util.List free
        Collections of connections, the Connections on the free list are avaialable for use, the connections on the used list are currently assigned.
      • used

        protected java.util.HashMap used
        Hashtable mapping "object references" to connections.
      • pingapiconn

        protected java.util.HashMap pingapiconn
      • MAX_PING_REQUESTS

        protected int MAX_PING_REQUESTS
      • MAX_PING_TIMEOUT_MILLISECONDS

        protected int MAX_PING_TIMEOUT_MILLISECONDS
      • driverString

        protected java.lang.String driverString
        String for selecting the JDBC driver for this Pool of connections
      • driver

        protected java.sql.Driver driver
        driver for database connection.
      • jdbcCollection

        protected java.lang.String jdbcCollection
        DB2 jdbcCollection; defaults to null.
      • initialized

        protected boolean initialized
        Defaults to false. Set to true once "this" has been initialized.
      • dbProductName

        protected java.lang.String dbProductName
      • dbProductVersionMajMin

        protected java.lang.String dbProductVersionMajMin
      • dbProductVersion

        protected java.lang.String dbProductVersion
      • disableServerCursor

        protected static boolean disableServerCursor
      • fetchUse

        protected static boolean fetchUse
      • fetchSize

        protected static int fetchSize
      • resultSetType

        protected static int resultSetType
      • ssPropLoaded

        public boolean ssPropLoaded
      • dbPlatform

        protected static int dbPlatform
        Database platform
        See Also:
        UpgConstants
      • isRAC

        protected static boolean isRAC
      • db2Version

        protected static double db2Version
      • dbSqlServerDriver

        protected static int dbSqlServerDriver
      • driverInfoShown

        protected boolean driverInfoShown
      • schemaOwner

        protected java.lang.String schemaOwner
        Schema owner of the database tables. Default is "MAXIMO". Can be set from the properties file mxe.db.schemaowner=maximo
      • maxFreeConnections

        protected int maxFreeConnections
      • minFreeConnections

        protected int minFreeConnections
      • newConnectionCount

        protected int newConnectionCount
      • sslConnection

        protected java.lang.String sslConnection
      • sslTrustStoreLocation

        protected java.lang.String sslTrustStoreLocation
      • sslTrustStorePassword

        protected java.lang.String sslTrustStorePassword
      • systemConnection

        protected ConRef systemConnection
      • sequenceConnection

        protected ConRef sequenceConnection
      • connectionPoolThread

        protected psdi.server.DBManager.ConnectionPoolThread connectionPoolThread
      • connectionKeyMap

        protected java.util.Map connectionKeyMap
      • refQue

        public java.lang.ref.ReferenceQueue refQue
      • stmtQueue

        public java.util.concurrent.ConcurrentLinkedQueue stmtQueue
    • Constructor Detail

      • DBManager

        public DBManager()
        Constructs an empty Pool
        Parameters:
        name - the name of this DBManager
    • Method Detail

      • getLock

        public DBManager.Lock getLock(java.lang.Object connectionKey)
      • configure

        public void configure(java.util.Properties properties)
        configure the DBManager based on the information in the properties file read in.
      • getSchemaOwner

        public java.lang.String getSchemaOwner()
        Returns the database schema owner.
      • getProperties

        public java.util.Properties getProperties()
        properties are the ones handed in to this Pool at construction time.
      • getName

        public java.lang.String getName()
        Name of the pool a.k.a. DataSource
      • setUseStoredOutline

        protected void setUseStoredOutline(java.sql.Connection connection)
                                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getDatabaseProductName

        public java.lang.String getDatabaseProductName()
        Returns the database product name.
      • getDatabaseProductSimpleVersion

        public java.lang.String getDatabaseProductSimpleVersion()
        Returns the database product version Major.Minor.
      • getDatabaseProductVersion

        public java.lang.String getDatabaseProductVersion()
        Returns the database product version string.
      • getSSDisableCursor

        public static boolean getSSDisableCursor()
        Returns if server cursor is disabled or not for Sql server.
      • getSSFetchUse

        public static boolean getSSFetchUse()
        Returns if fetch size can be used or not for Sql server.
      • getSSFetchSize

        public static int getSSFetchSize()
        Returns fetch size for Sql server.
      • getSSCursorType

        public static int getSSCursorType()
        Returns cursor type for Sql server.
      • getDbSqlServerDriver

        public static int getDbSqlServerDriver()
        Returns constant for SqlServer driver.
      • getDBPlatform

        public static int getDBPlatform()
        Returns the database platform as an integer.
        See Also:
        UpgConstants
      • getDB2Version

        public static double getDB2Version()
        If this is a DB2 database, returns the DB2 version, else returns 0.
      • init

        public boolean init()
        Loads a driver, and establishes a series of connections with the specified database.
        Returns:
        true if connections succeed, false otherwise.
      • destroy

        public void destroy()
        Closes database connections, set's both the used and free vectors to null
      • getConnection

        public java.sql.Connection getConnection(ConnectionKey conKey)
      • printStackTraceNoMsg

        public static void printStackTraceNoMsg(java.lang.Throwable e)
        print out stacktrace of an exception to std err without using maxmessage to avoid deadlock or infinit loop
      • setApiPingConn

        public boolean setApiPingConn(java.net.InetAddress inetAddress,
                                      ConnectionKey conKey)
      • apiPingConnExists

        public boolean apiPingConnExists(java.net.InetAddress inetAddress)
      • removeApiPingConn

        public void removeApiPingConn(ConRef conref)
      • freeConnection

        public void freeConnection(ConnectionKey conKey)
      • getSystemConnectionKey

        public ConnectionKey getSystemConnectionKey()
        Returns SystemConnectionKey object to use to get System connection.
        Returns:
      • getSequenceConnection

        public java.sql.Connection getSequenceConnection()
        Returns the connection used for generating sequence for sqlserver This should not be used by any application services or business objects.
      • getDBConnTotal

        public int getDBConnTotal()
      • getDBConnUsed

        public int getDBConnUsed()
      • getDBConnFree

        public int getDBConnFree()
      • getDBAuthenticationType

        public int getDBAuthenticationType()
        Return the authentication type. 0 means no proxy authentication involved. This method should be overwritten by inherited db managers to return the correct value.
      • getSQLTimeLimit

        public static long getSQLTimeLimit()
      • needToLogSQLOnTimeLimit

        public static boolean needToLogSQLOnTimeLimit()
      • reloadSQLTimeLimit

        public static void reloadSQLTimeLimit()
      • reloadLogSQLPlan

        public static void reloadLogSQLPlan()
        Reload the cached value we have for property mxe.db.logSQLPlan when the value of that property has changed.
        See Also:
        DBManager.readLogSQLPlan
      • reloadSQLScanExclude

        public static void reloadSQLScanExclude()
      • reloadDBRowCount

        public void reloadDBRowCount()
      • reloadDBRefCount

        public void reloadDBRefCount()
      • reloadProperties

        public void reloadProperties(java.util.Properties props)
                              throws MXException
        This is called from MaxPropCache when reloading properties from maximo.properties file when WAS fine-grained application update has been used.
        Throws:
        MXException
      • readSQLTimeLimit

        public static void readSQLTimeLimit()
      • sqlTableScanExclude

        public static java.util.Vector sqlTableScanExclude()
      • logSQLPlan

        public static java.lang.StringBuffer logSQLPlan(java.sql.Connection conn,
                                                        java.lang.String sqlStatement)
      • getSPID

        public static java.lang.String getSPID(java.sql.Connection connection)
        Get the SPID from database for each connection.Don't use this method directly. Use Conref.getSPID() if connection is a conref.
        Parameters:
        connection -
        Throws:
        java.lang.Exception
      • flushFreeConnections

        public void flushFreeConnections()
                                  throws java.rmi.RemoteException
        Throws:
        java.rmi.RemoteException
      • getTenantUsedConnCount

        public java.util.HashMap getTenantUsedConnCount(UserInfo ui,
                                                        java.util.List allTenants)
                                                 throws MXException
        Throws:
        MXException
      • finalization

        public void finalization()
                          throws java.lang.InterruptedException
        Continuesly clean up the phantom references for the clean up system resources. This method is blocking on the queue of the reference and anc contitue forever.
        Throws:
        java.lang.InterruptedException
      • finalization

        public void finalization(int timeMilli)
                          throws java.lang.InterruptedException
        Engage in the clean up of the objects in the phantom reference queue for the specified amount of time. During the execution, if error happens, the exception will be logged, but the process will continue.
        Parameters:
        max -
        Throws:
        java.lang.InterruptedException
      • cleanupStatementQueue

        public void cleanupStatementQueue()
                                   throws java.lang.InterruptedException
        Continuesly clean up the statement queue.
        Throws:
        java.lang.InterruptedException
      • getReferenceQueue

        public java.lang.ref.ReferenceQueue getReferenceQueue()
        get the refrence quque.
        Returns: