| org.h2.api.DatabaseEventListener
All known Subclasses: org.h2.test.unit.TestExit, org.h2.test.jdbc.TestDatabaseEventListener, org.h2.test.db.TestMultiConn, org.h2.test.db.TestOpenClose, org.h2.server.web.WebThread, org.h2.samples.ShowProgress, org.h2.test.db.TestListener,
DatabaseEventListener | public interface DatabaseEventListener extends EventListener(Code) | | A class that implements this interface can get notified about exceptions
and other events. A database event listener can be registered when
connecting to a database. Example database URL:
jdbc:h2:test;DATABASE_EVENT_LISTENER='com.acme.DbListener'
|
Field Summary | |
int | STATE_BACKUP_FILE This state is used during the BACKUP command. | int | STATE_CREATE_INDEX This state is used when re-creating an index. | int | STATE_RECOVER This state is used when re-applying the transaction log or rolling back
uncommitted transactions. | int | STATE_SCAN_FILE This state is used when scanning the data or index file. |
Method Summary | |
void | closingDatabase() This method is called before the database is closed normally. | void | diskSpaceIsLow(long stillAvailable) This method is called if the disk space is very low.
One strategy is to inform the user and wait for it to clean up disk space.
Another strategy is to send an email to the administrator in this method and
then throw a SQLException. | void | exceptionThrown(SQLException e, String sql) | void | init(String url) This method is called just after creating the object. | void | opened() This method is called after the database has been opened. | void | setProgress(int state, String name, int x, int max) This method is called for long running events, such as recovering,
scanning a file or building an index. |
STATE_BACKUP_FILE | int STATE_BACKUP_FILE(Code) | | This state is used during the BACKUP command.
|
STATE_CREATE_INDEX | int STATE_CREATE_INDEX(Code) | | This state is used when re-creating an index.
|
STATE_RECOVER | int STATE_RECOVER(Code) | | This state is used when re-applying the transaction log or rolling back
uncommitted transactions.
|
STATE_SCAN_FILE | int STATE_SCAN_FILE(Code) | | This state is used when scanning the data or index file.
|
closingDatabase | void closingDatabase()(Code) | | This method is called before the database is closed normally. It is save
to connect to the database and execute statements at this point, however
the connection must be closed before the method returns.
|
diskSpaceIsLow | void diskSpaceIsLow(long stillAvailable) throws SQLException(Code) | | This method is called if the disk space is very low.
One strategy is to inform the user and wait for it to clean up disk space.
Another strategy is to send an email to the administrator in this method and
then throw a SQLException. The database should not be accessed from
within this method (even to close it).
Parameters: stillAvailable - the estimated space that is still available, in bytes throws: SQLException - if the operation should be cancelled |
exceptionThrown | void exceptionThrown(SQLException e, String sql)(Code) | | This method is called if an exception occurred during database recovery
Parameters: e - the exception Parameters: sql - the SQL statement |
init | void init(String url)(Code) | | This method is called just after creating the object.
This is done when opening the database if the listener is specified
in the database URL, but may be later if the listener is set at
runtime with the SET SQL statement.
Parameters: url - - the database URL |
opened | void opened()(Code) | | This method is called after the database has been opened.
It is save to connect to the database and execute statements at this point.
|
setProgress | void setProgress(int state, String name, int x, int max)(Code) | | This method is called for long running events, such as recovering,
scanning a file or building an index.
Parameters: state - the state Parameters: name - the object name Parameters: x - the current position Parameters: max - the highest value |
|
|