Class ShowProgress

  • All Implemented Interfaces:
    java.util.EventListener, DatabaseEventListener

    public class ShowProgress
    extends java.lang.Object
    implements DatabaseEventListener
    This example application implements a database event listener. This is useful to display progress information while opening a large database, or to log database exceptions.
    • Constructor Detail

      • ShowProgress

        public ShowProgress()
        Create a new instance of this class, and startNs the timer.
    • Method Detail

      • main

        public static void main​(java.lang.String... args)
                         throws java.lang.Exception
        This method is called when executing this sample application from the command line.
        Parameters:
        args - the command line parameters
        Throws:
        java.lang.Exception - on failure
      • exceptionThrown

        public void exceptionThrown​(java.sql.SQLException e,
                                    java.lang.String sql)
        This method is called if an exception occurs in the database.
        Specified by:
        exceptionThrown in interface DatabaseEventListener
        Parameters:
        e - the exception
        sql - the SQL statement
      • setProgress

        public void setProgress​(int state,
                                java.lang.String name,
                                long current,
                                long max)
        This method is called when opening the database to notify about the progress.
        Specified by:
        setProgress in interface DatabaseEventListener
        Parameters:
        state - the current state
        name - the object name (depends on the state)
        current - the current progress
        max - the 100% mark
      • init

        public void init​(java.lang.String url)
        This method is called just after creating the instance.
        Specified by:
        init in interface DatabaseEventListener
        Parameters:
        url - the database URL
      • opened

        public void opened()
        This method is called when the database is open.
        Specified by:
        opened in interface DatabaseEventListener