public class DBManager extends java.lang.Object implements FixedLoggers
Modifier and Type | Class and Description |
---|---|
protected class |
DBManager.Lock |
Modifier and Type | Field and Description |
---|---|
protected java.util.Map |
connectionKeyMap |
protected psdi.server.DBManager.ConnectionPoolThread |
connectionPoolThread |
protected static double |
db2Version |
protected static int |
dbPlatform
Database platform
|
protected java.lang.String |
dbProductName |
protected java.lang.String |
dbProductVersion |
protected java.lang.String |
dbProductVersionMajMin |
protected static java.lang.String |
dbPropPrefix
The property prefix for db
|
protected static int |
dbSqlServerDriver |
protected static java.lang.String |
defaultSchemaOwner |
protected static boolean |
disableServerCursor |
protected java.sql.Driver |
driver
driver for database connection.
|
protected boolean |
driverInfoShown |
protected java.lang.String |
driverString
String for selecting the JDBC driver for this Pool of connections
|
static int |
FASTFORWARD |
protected static int |
fetchSize |
protected static boolean |
fetchUse |
static int |
FORWARDONLY |
protected 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.
|
protected boolean |
initialized
Defaults to false.
|
protected static boolean |
isRAC |
protected java.lang.String |
jdbcCollection
DB2 jdbcCollection; defaults to null.
|
protected int |
MAX_PING_REQUESTS |
protected int |
MAX_PING_TIMEOUT_MILLISECONDS |
protected int |
maxFreeConnections |
protected int |
minFreeConnections |
protected java.lang.String |
name
The Datasource name, this is label users specify to get a connection
from this pool.
|
protected int |
newConnectionCount |
protected java.util.HashMap |
pingapiconn |
java.lang.ref.ReferenceQueue |
refQue |
protected static int |
resultSetType |
protected java.lang.String |
schemaOwner
Schema owner of the database tables.
|
static int |
SCROLLINSENSITIVE |
static int |
SCROLLSENSITIVE |
static int |
SCROLLSENSITIVEONE |
protected ConRef |
sequenceConnection |
protected java.lang.String |
sslConnection |
protected java.lang.String |
sslTrustStoreLocation |
protected java.lang.String |
sslTrustStorePassword |
boolean |
ssPropLoaded |
java.util.concurrent.ConcurrentLinkedQueue |
stmtQueue |
protected ConRef |
systemConnection |
protected java.lang.String |
urlString
Url of the database to connect to
|
protected java.util.HashMap |
used
Hashtable mapping "object references" to connections.
|
APPLOGGER, CRONTASKLOGGER, CRONTASKMGRLOGGER, CRONTASKMGRSQLLOGGER, DBCONNECTIONLOGGER, DDLOGGER, DMLOGGER, EVENTLOGGER, EXCEPTIONLOGGER, MAILLOGGER, MAXIMOLOGGER, MTLOGGER, NULLMBOPOINTER, SECURITY, SENDFAILEDLOGGER, SERVICELOGGER, SQLLOGGER
appenderPrefix, LOGGERNAME_APP, LOGGERNAME_CRONTASK, LOGGERNAME_CRONTASKMGR, LOGGERNAME_DBCONNECTION, LOGGERNAME_DD, LOGGERNAME_DM, LOGGERNAME_DMPREVIEW, LOGGERNAME_EVENT, LOGGERNAME_EXCEPTION, LOGGERNAME_MAIL, LOGGERNAME_MAXIMO, LOGGERNAME_MT, LOGGERNAME_NULLMBOPOINTER, LOGGERNAME_SECURITY, LOGGERNAME_SENDFAILED, LOGGERNAME_SERVICE, LOGGERNAME_SQL, LOGGERNAME_SQL_CRONTASKMGR, LOGGERNAME_TXN, loggerPrefix
Constructor and Description |
---|
DBManager()
Constructs an empty Pool
|
Modifier and Type | Method and Description |
---|---|
boolean |
apiPingConnExists(java.net.InetAddress inetAddress) |
void |
cleanupStatementQueue()
Continuesly clean up the statement queue.
|
void |
configure(java.util.Properties properties)
configure the DBManager based on the
information in the properties file read in.
|
void |
destroy()
Closes database connections, set's both the used and free vectors to null
|
void |
finalization()
Continuesly clean up the phantom references for the clean up system resources.
|
void |
finalization(int timeMilli)
Engage in the clean up of the objects in the phantom reference queue for the specified amount of time.
|
void |
flushFreeConnections() |
void |
forceFreeConnection(ConnectionKeyLight conKey) |
void |
freeConnection(ConnectionKey conKey) |
void |
freeConnection(ConnectionKeyLight conKey) |
java.sql.Connection |
getConnection(ConnectionKey conKey) |
DBCredentialHandler |
getCredentialHandler() |
java.lang.String |
getDatabaseProductName()
Returns the database product name.
|
java.lang.String |
getDatabaseProductSimpleVersion()
Returns the database product version Major.Minor.
|
java.lang.String |
getDatabaseProductVersion()
Returns the database product version string.
|
static double |
getDB2Version()
If this is a DB2 database, returns the DB2 version, else returns 0.
|
int |
getDBAuthenticationType()
Return the authentication type.
|
int |
getDBConnFree() |
int |
getDBConnTotal() |
int |
getDBConnUsed() |
static int |
getDBPlatform()
Returns the database platform as an integer.
|
static int |
getDbSqlServerDriver()
Returns constant for SqlServer driver.
|
DBManager.Lock |
getLock(java.lang.Object connectionKey) |
java.lang.String |
getName()
Name of the pool a.k.a.
|
java.util.Properties |
getProperties()
properties are the ones handed in to this Pool at construction time.
|
java.lang.ref.ReferenceQueue |
getReferenceQueue()
get the refrence quque.
|
java.lang.String |
getSchemaOwner()
Returns the database schema owner.
|
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.
|
static java.lang.String |
getSPID(java.sql.Connection connection)
Get the SPID from database for each connection.Don't use this method directly.
|
static long |
getSQLTimeLimit() |
static int |
getSSCursorType()
Returns cursor type for Sql server.
|
static boolean |
getSSDisableCursor()
Returns if server cursor is disabled or not for Sql server.
|
static int |
getSSFetchSize()
Returns fetch size for Sql server.
|
static boolean |
getSSFetchUse()
Returns if fetch size can be used or not for Sql server.
|
ConnectionKey |
getSystemConnectionKey()
Returns SystemConnectionKey object to use to get System connection.
|
java.util.HashMap |
getTenantUsedConnCount(UserInfo ui,
java.util.List allTenants) |
boolean |
init()
Loads a driver, and establishes a series of connections with
the specified database.
|
static java.lang.StringBuffer |
logSQLPlan(java.sql.Connection conn,
java.lang.String sqlStatement) |
static boolean |
needToLogSQLOnTimeLimit() |
static boolean |
needToLogSQLPlan()
Identifies whether we need to log Sql plan (property mxe.db.logSQLPlan).
|
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
|
static void |
readSQLTimeLimit() |
void |
reloadDBRefCount() |
void |
reloadDBRowCount() |
static void |
reloadLogSQLPlan()
Reload the cached value we have for property mxe.db.logSQLPlan
when the value of that property has changed.
|
void |
reloadProperties(java.util.Properties props)
This is called from MaxPropCache when reloading properties from maximo.properties file
when WAS fine-grained application update has been used.
|
static void |
reloadSQLScanExclude() |
static void |
reloadSQLTimeLimit() |
void |
removeApiPingConn(ConRef conref) |
boolean |
setApiPingConn(java.net.InetAddress inetAddress,
ConnectionKey conKey) |
protected void |
setUseStoredOutline(java.sql.Connection connection) |
static java.util.Vector |
sqlTableScanExclude() |
protected static final java.lang.String dbPropPrefix
protected static final java.lang.String defaultSchemaOwner
protected java.lang.String name
protected java.lang.String urlString
protected volatile java.util.List free
protected java.util.HashMap used
protected java.util.HashMap pingapiconn
protected int MAX_PING_REQUESTS
protected int MAX_PING_TIMEOUT_MILLISECONDS
protected java.lang.String driverString
protected java.sql.Driver driver
protected java.lang.String jdbcCollection
protected boolean initialized
protected java.lang.String dbProductName
protected java.lang.String dbProductVersionMajMin
protected java.lang.String dbProductVersion
protected static boolean disableServerCursor
protected static boolean fetchUse
protected static int fetchSize
protected static int resultSetType
public static final int FORWARDONLY
public static final int SCROLLINSENSITIVE
public static final int SCROLLSENSITIVE
public static final int SCROLLSENSITIVEONE
public static final int FASTFORWARD
public boolean ssPropLoaded
protected static int dbPlatform
UpgConstants
protected static boolean isRAC
protected static double db2Version
protected static int dbSqlServerDriver
protected boolean driverInfoShown
protected java.lang.String schemaOwner
protected int maxFreeConnections
protected int minFreeConnections
protected int newConnectionCount
protected java.lang.String sslConnection
protected java.lang.String sslTrustStoreLocation
protected java.lang.String sslTrustStorePassword
protected ConRef systemConnection
protected ConRef sequenceConnection
protected psdi.server.DBManager.ConnectionPoolThread connectionPoolThread
protected java.util.Map connectionKeyMap
public java.lang.ref.ReferenceQueue refQue
public java.util.concurrent.ConcurrentLinkedQueue stmtQueue
public DBManager()
name
- the name of this DBManagerpublic DBManager.Lock getLock(java.lang.Object connectionKey)
public void configure(java.util.Properties properties)
public java.lang.String getSchemaOwner()
public java.util.Properties getProperties()
public java.lang.String getName()
protected void setUseStoredOutline(java.sql.Connection connection) throws java.sql.SQLException
java.sql.SQLException
public java.lang.String getDatabaseProductName()
public java.lang.String getDatabaseProductSimpleVersion()
public java.lang.String getDatabaseProductVersion()
public static boolean getSSDisableCursor()
public static boolean getSSFetchUse()
public static int getSSFetchSize()
public static int getSSCursorType()
public static int getDbSqlServerDriver()
public static int getDBPlatform()
UpgConstants
public static double getDB2Version()
public boolean init()
public void destroy()
public java.sql.Connection getConnection(ConnectionKey conKey)
public static void printStackTraceNoMsg(java.lang.Throwable e)
public boolean setApiPingConn(java.net.InetAddress inetAddress, ConnectionKey conKey)
public boolean apiPingConnExists(java.net.InetAddress inetAddress)
public void removeApiPingConn(ConRef conref)
public void freeConnection(ConnectionKey conKey)
public void freeConnection(ConnectionKeyLight conKey)
public void forceFreeConnection(ConnectionKeyLight conKey)
public ConnectionKey getSystemConnectionKey()
public java.sql.Connection getSequenceConnection()
public int getDBConnTotal()
public int getDBConnUsed()
public int getDBConnFree()
public int getDBAuthenticationType()
public DBCredentialHandler getCredentialHandler()
public static long getSQLTimeLimit()
public static boolean needToLogSQLOnTimeLimit()
public static void reloadSQLTimeLimit()
public static boolean needToLogSQLPlan()
DBManager.readLogSQLPlan
,
DBManager.logSQLPlan
public static void reloadLogSQLPlan()
DBManager.readLogSQLPlan
public static void reloadSQLScanExclude()
public void reloadDBRowCount()
public void reloadDBRefCount()
public void reloadProperties(java.util.Properties props) throws MXException
MXException
public static void readSQLTimeLimit()
public static java.util.Vector sqlTableScanExclude()
public static java.lang.StringBuffer logSQLPlan(java.sql.Connection conn, java.lang.String sqlStatement)
public static java.lang.String getSPID(java.sql.Connection connection)
connection
- java.lang.Exception
public void flushFreeConnections() throws java.rmi.RemoteException
java.rmi.RemoteException
public java.util.HashMap getTenantUsedConnCount(UserInfo ui, java.util.List allTenants) throws MXException
MXException
public void finalization() throws java.lang.InterruptedException
java.lang.InterruptedException
public void finalization(int timeMilli) throws java.lang.InterruptedException
max
- java.lang.InterruptedException
public void cleanupStatementQueue() throws java.lang.InterruptedException
java.lang.InterruptedException
public java.lang.ref.ReferenceQueue getReferenceQueue()