1/*- 2 * See the file LICENSE for redistribution information. 3 * 4 * Copyright (c) 1997,2008 Oracle. All rights reserved. 5 * 6 * $Id: PanicHandler.java,v 12.7 2008/01/17 05:04:53 mjc Exp $ 7 */ 8package com.sleepycat.db; 9 10/** 11An interface specifying a function to be called if the database 12environment panics. 13*/ 14public interface PanicHandler { 15 /** 16 A function to be called if the database environment panics. 17 <p> 18 Errors can occur in the Berkeley DB library where the only solution 19 is to shut down the application and run recovery (for example, if 20 Berkeley DB is unable to allocate heap memory). In such cases, the 21 Berkeley DB methods will throw a {@link com.sleepycat.db.RunRecoveryException RunRecoveryException}. 22 <p> 23 It is often easier to simply exit the application when such errors occur rather than gracefully return up the stack. The panic 24 callback function is a function called when {@link com.sleepycat.db.RunRecoveryException RunRecoveryException} is about to be thrown from a from a 25 Berkeley DB method. 26 <p> 27 @param environment 28 The enclosing database environment handle. 29 <p> 30 @param e 31 The {@link com.sleepycat.db.DatabaseException DatabaseException} that would have been thrown to 32 the calling method. 33 */ 34 void panic(Environment environment, DatabaseException e); 35} 36