Package org.h2.jmx

Class DatabaseInfo

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Database database
      Database.
      private static java.util.Map<java.lang.String,​javax.management.ObjectName> MBEANS  
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 MBean
        path - 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 info
        database - 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 failure
        java.lang.Exception
      • isExclusive

        public boolean isExclusive()
        Description copied from interface: DatabaseInfoMBean
        Is the database open in exclusive mode?
        Specified by:
        isExclusive in interface DatabaseInfoMBean
        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 interface DatabaseInfoMBean
        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 interface DatabaseInfoMBean
        Returns:
        the database mode
      • getFileWriteCount

        public long getFileWriteCount()
        Description copied from interface: DatabaseInfoMBean
        The number of write operations since the database was opened.
        Specified by:
        getFileWriteCount in interface DatabaseInfoMBean
        Returns:
        the write count
      • 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 interface DatabaseInfoMBean
        Returns:
        information about the sessions