Package org.h2.jmx
Class DatabaseInfo
- java.lang.Object
-
- org.h2.jmx.DatabaseInfo
-
- All Implemented Interfaces:
DatabaseInfoMBean
public class DatabaseInfo extends java.lang.Object implements DatabaseInfoMBean
The MBean implementation.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateDatabaseInfo(Database database)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCacheSize()The current cache size in KB.intgetCacheSizeMax()The maximum cache size in KB.longgetFileReadCount()The file read count since the database was opened.longgetFileSize()The database file size in KB.longgetFileWriteCount()The number of write operations since the database was opened.java.lang.StringgetMode()The database compatibility mode (REGULAR if no compatibility mode is used).private static javax.management.ObjectNamegetObjectName(java.lang.String name, java.lang.String path)Returns a JMX new ObjectName instance.intgetTraceLevel()The trace level (0 disabled, 1 error, 2 info, 3 debug).java.lang.StringgetVersion()The database version.booleanisExclusive()Is the database open in exclusive mode?booleanisReadOnly()Is the database read-only?java.lang.StringlistSessions()List sessions, including the queries that are in progress, and locked tables.java.lang.StringlistSettings()List the database settings.static voidregisterMBean(ConnectionInfo connectionInfo, Database database)Registers an MBean for the database.voidsetCacheSizeMax(int kb)Change the maximum size.voidsetTraceLevel(int level)Set the trace level.static voidunregisterMBean(java.lang.String name)Unregisters the MBean for the database if one is registered.
-
-
-
Field Detail
-
MBEANS
private static final java.util.Map<java.lang.String,javax.management.ObjectName> MBEANS
-
database
private final Database database
Database.
-
-
Constructor Detail
-
DatabaseInfo
private DatabaseInfo(Database database)
-
-
Method Detail
-
getObjectName
private static javax.management.ObjectName getObjectName(java.lang.String name, java.lang.String path) throws javax.management.JMExceptionReturns a JMX new ObjectName instance.- Parameters:
name- name of the MBeanpath- the path- Returns:
- a new ObjectName instance
- Throws:
javax.management.JMException- if the ObjectName could not be created
-
registerMBean
public static void registerMBean(ConnectionInfo connectionInfo, Database database) throws javax.management.JMException
Registers an MBean for the database.- Parameters:
connectionInfo- connection infodatabase- database- Throws:
javax.management.JMException- on failure
-
unregisterMBean
public static void unregisterMBean(java.lang.String name) throws java.lang.ExceptionUnregisters the MBean for the database if one is registered.- Parameters:
name- database name- Throws:
javax.management.JMException- on failurejava.lang.Exception
-
isExclusive
public boolean isExclusive()
Description copied from interface:DatabaseInfoMBeanIs the database open in exclusive mode?- Specified by:
isExclusivein interfaceDatabaseInfoMBean- Returns:
- true if the database is open in exclusive mode, false otherwise
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:DatabaseInfoMBeanIs the database read-only?- Specified by:
isReadOnlyin interfaceDatabaseInfoMBean- Returns:
- true if the database is read-only, false otherwise
-
getMode
public java.lang.String getMode()
Description copied from interface:DatabaseInfoMBeanThe database compatibility mode (REGULAR if no compatibility mode is used).- Specified by:
getModein interfaceDatabaseInfoMBean- Returns:
- the database mode
-
getTraceLevel
public int getTraceLevel()
Description copied from interface:DatabaseInfoMBeanThe trace level (0 disabled, 1 error, 2 info, 3 debug).- Specified by:
getTraceLevelin interfaceDatabaseInfoMBean- Returns:
- the level
-
setTraceLevel
public void setTraceLevel(int level)
Description copied from interface:DatabaseInfoMBeanSet the trace level.- Specified by:
setTraceLevelin interfaceDatabaseInfoMBean- Parameters:
level- the new value
-
getFileWriteCount
public long getFileWriteCount()
Description copied from interface:DatabaseInfoMBeanThe number of write operations since the database was opened.- Specified by:
getFileWriteCountin interfaceDatabaseInfoMBean- Returns:
- the write count
-
getFileReadCount
public long getFileReadCount()
Description copied from interface:DatabaseInfoMBeanThe file read count since the database was opened.- Specified by:
getFileReadCountin interfaceDatabaseInfoMBean- Returns:
- the read count
-
getFileSize
public long getFileSize()
Description copied from interface:DatabaseInfoMBeanThe database file size in KB.- Specified by:
getFileSizein interfaceDatabaseInfoMBean- Returns:
- the number of pages
-
getCacheSizeMax
public int getCacheSizeMax()
Description copied from interface:DatabaseInfoMBeanThe maximum cache size in KB.- Specified by:
getCacheSizeMaxin interfaceDatabaseInfoMBean- Returns:
- the maximum size
-
setCacheSizeMax
public void setCacheSizeMax(int kb)
Description copied from interface:DatabaseInfoMBeanChange the maximum size.- Specified by:
setCacheSizeMaxin interfaceDatabaseInfoMBean- Parameters:
kb- the cache size in KB.
-
getCacheSize
public int getCacheSize()
Description copied from interface:DatabaseInfoMBeanThe current cache size in KB.- Specified by:
getCacheSizein interfaceDatabaseInfoMBean- Returns:
- the current size
-
getVersion
public java.lang.String getVersion()
Description copied from interface:DatabaseInfoMBeanThe database version.- Specified by:
getVersionin interfaceDatabaseInfoMBean- Returns:
- the version
-
listSettings
public java.lang.String listSettings()
Description copied from interface:DatabaseInfoMBeanList the database settings.- Specified by:
listSettingsin interfaceDatabaseInfoMBean- Returns:
- the database settings
-
listSessions
public java.lang.String listSessions()
Description copied from interface:DatabaseInfoMBeanList sessions, including the queries that are in progress, and locked tables.- Specified by:
listSessionsin interfaceDatabaseInfoMBean- Returns:
- information about the sessions
-
-