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 private
DatabaseInfo(Database database)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCacheSize()
The current cache size in KB.int
getCacheSizeMax()
The maximum cache size in KB.long
getFileReadCount()
The file read count since the database was opened.long
getFileSize()
The database file size in KB.long
getFileWriteCount()
The number of write operations since the database was opened.java.lang.String
getMode()
The database compatibility mode (REGULAR if no compatibility mode is used).private static javax.management.ObjectName
getObjectName(java.lang.String name, java.lang.String path)
Returns a JMX new ObjectName instance.int
getTraceLevel()
The trace level (0 disabled, 1 error, 2 info, 3 debug).java.lang.String
getVersion()
The database version.boolean
isExclusive()
Is the database open in exclusive mode?boolean
isReadOnly()
Is the database read-only?java.lang.String
listSessions()
List sessions, including the queries that are in progress, and locked tables.java.lang.String
listSettings()
List the database settings.static void
registerMBean(ConnectionInfo connectionInfo, Database database)
Registers an MBean for the database.void
setCacheSizeMax(int kb)
Change the maximum size.void
setTraceLevel(int level)
Set the trace level.static void
unregisterMBean(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.JMException
Returns 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.Exception
Unregisters 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:DatabaseInfoMBean
Is the database open in exclusive mode?- Specified by:
isExclusive
in interfaceDatabaseInfoMBean
- Returns:
- true if the database is open in exclusive mode, false otherwise
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:DatabaseInfoMBean
Is the database read-only?- Specified by:
isReadOnly
in interfaceDatabaseInfoMBean
- Returns:
- true if the database is read-only, false otherwise
-
getMode
public java.lang.String getMode()
Description copied from interface:DatabaseInfoMBean
The database compatibility mode (REGULAR if no compatibility mode is used).- Specified by:
getMode
in interfaceDatabaseInfoMBean
- Returns:
- the database mode
-
getTraceLevel
public int getTraceLevel()
Description copied from interface:DatabaseInfoMBean
The trace level (0 disabled, 1 error, 2 info, 3 debug).- Specified by:
getTraceLevel
in interfaceDatabaseInfoMBean
- Returns:
- the level
-
setTraceLevel
public void setTraceLevel(int level)
Description copied from interface:DatabaseInfoMBean
Set the trace level.- Specified by:
setTraceLevel
in interfaceDatabaseInfoMBean
- Parameters:
level
- the new value
-
getFileWriteCount
public long getFileWriteCount()
Description copied from interface:DatabaseInfoMBean
The number of write operations since the database was opened.- Specified by:
getFileWriteCount
in interfaceDatabaseInfoMBean
- Returns:
- the write count
-
getFileReadCount
public long getFileReadCount()
Description copied from interface:DatabaseInfoMBean
The file read count since the database was opened.- Specified by:
getFileReadCount
in interfaceDatabaseInfoMBean
- Returns:
- the read count
-
getFileSize
public long getFileSize()
Description copied from interface:DatabaseInfoMBean
The database file size in KB.- Specified by:
getFileSize
in interfaceDatabaseInfoMBean
- Returns:
- the number of pages
-
getCacheSizeMax
public int getCacheSizeMax()
Description copied from interface:DatabaseInfoMBean
The maximum cache size in KB.- Specified by:
getCacheSizeMax
in interfaceDatabaseInfoMBean
- Returns:
- the maximum size
-
setCacheSizeMax
public void setCacheSizeMax(int kb)
Description copied from interface:DatabaseInfoMBean
Change the maximum size.- Specified by:
setCacheSizeMax
in interfaceDatabaseInfoMBean
- Parameters:
kb
- the cache size in KB.
-
getCacheSize
public int getCacheSize()
Description copied from interface:DatabaseInfoMBean
The current cache size in KB.- Specified by:
getCacheSize
in interfaceDatabaseInfoMBean
- Returns:
- the current size
-
getVersion
public java.lang.String getVersion()
Description copied from interface:DatabaseInfoMBean
The database version.- Specified by:
getVersion
in interfaceDatabaseInfoMBean
- Returns:
- the version
-
listSettings
public java.lang.String listSettings()
Description copied from interface:DatabaseInfoMBean
List the database settings.- Specified by:
listSettings
in interfaceDatabaseInfoMBean
- Returns:
- the database settings
-
listSessions
public java.lang.String listSessions()
Description copied from interface:DatabaseInfoMBean
List sessions, including the queries that are in progress, and locked tables.- Specified by:
listSessions
in interfaceDatabaseInfoMBean
- Returns:
- information about the sessions
-
-