private static class DatabaseStatistics.DatabaseHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.sql.Connection |
connection
Database connection
|
(package private) static java.lang.String |
dbPass
Connection password; defaults to empty string, but may be overridden in directory
|
private static java.lang.String |
dbURL
JDBC URL to open/create/connect database
|
(package private) static java.lang.String |
dbUser
Connection user name; defaults to empty string, but may be overridden in directory
|
private static long |
runId
Unique identifier for the current run of the application
|
private java.sql.PreparedStatement |
stmtCacheInsert
Cache statistic record insert statement
|
private java.sql.PreparedStatement |
stmtDatabaseInsert
Database record insert statement
|
private java.sql.PreparedStatement |
stmtGlobalQueryInsert
Global query statistic record insert statement
|
private java.sql.PreparedStatement |
stmtLocalQueryInsert
Local query statistic record insert statement
|
Constructor and Description |
---|
DatabaseHelper()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
closeConnection()
Close the current connection.
|
(package private) void |
finalizeChanges()
Commit the outstanding transaction and run analyze on the database.
|
(package private) void |
insertCacheStatistic(long did,
long cnt,
long mem,
long hit,
long miss,
long put,
java.lang.String region)
Insert a second level cache statistics record.
|
(package private) long |
insertDatabaseRecord(java.lang.String name,
int type)
Insert a database record, which stores the server's run id in addition to the given
parameters.
|
(package private) long |
insertGlobalQueryStatistic(long did,
long min,
long max,
long avg,
long hit,
long miss,
long put,
long execnt,
long rowcnt,
java.lang.String hql)
Insert a global query statistics record, which stores the server's run id in addition to
the given parameters.
|
(package private) void |
insertLocalQueryStatistic(long gid,
java.lang.String fileName,
java.lang.String className,
java.lang.String methodName,
int lineNumber,
long cnt)
Insert a local query statistics record.
|
private void |
openConnection()
Open a new connection to the database (if one already opened, it will close it first).
|
static java.lang.String dbUser
static java.lang.String dbPass
private static final long runId
private static final java.lang.String dbURL
private final java.sql.PreparedStatement stmtDatabaseInsert
private final java.sql.PreparedStatement stmtGlobalQueryInsert
private final java.sql.PreparedStatement stmtLocalQueryInsert
private final java.sql.PreparedStatement stmtCacheInsert
private java.sql.Connection connection
long insertDatabaseRecord(java.lang.String name, int type)
name
- Physical name of Progress database matching the database for which we are
collecting results.type
- Database type:
long insertGlobalQueryStatistic(long did, long min, long max, long avg, long hit, long miss, long put, long execnt, long rowcnt, java.lang.String hql)
did
- Foreign key to related database.min
- Minimum query execution time, in ms.max
- Maximum query execution time, in ms.avg
- Average query execution time, in ms.hit
- Number of query cache hits for this query.miss
- Number of query cache misses for this query.put
- Number of query cache puts for this query.execnt
- Total number of executions of this query.rowcnt
- Total number of rows found by this query.hql
- Dialect-specific HQL which was executed.void insertLocalQueryStatistic(long gid, java.lang.String fileName, java.lang.String className, java.lang.String methodName, int lineNumber, long cnt)
gid
- Foreign key to related global query statistics record.fileName
- Unqualified source file name.className
- Partially qualified class file name (package root prefix has been trimmed).methodName
- Application-level method name in which query was constructed.lineNumber
- Application-level line number at which query was constructed.cnt
- Number of times query was executed at this location.void insertCacheStatistic(long did, long cnt, long mem, long hit, long miss, long put, java.lang.String region)
did
- Foreign key to related database.cnt
- Number of elements in memory in this cache region.mem
- Amount of memory used, in bytes, for this cache region.hit
- Number of cache hits for this region.miss
- Number of cache misses for this region.put
- Number of cache puts for this region.region
- Name of the cache region represented by this record.private void openConnection()
java.lang.RuntimeException
- if new connection could not be established.private void closeConnection()
java.lang.RuntimeException
- if connection could not be closed.void finalizeChanges()
java.lang.RuntimeException
- if there were errors during commit or analyze.