KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > RunRecoveryException


1 /*
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: RunRecoveryException.java,v 1.18 2006/10/30 21:14:12 bostic Exp $
7  */

8
9 package com.sleepycat.je;
10
11 import com.sleepycat.je.dbi.EnvironmentImpl;
12
13 /**
14  * Javadoc for this public class is generated
15  * via the doc templates in the doc_src directory.
16  */

17 public class RunRecoveryException extends DatabaseException {
18
19     private boolean alreadyThrown = false;
20
21     RunRecoveryException() {
22     super();
23     }
24
25     public RunRecoveryException(EnvironmentImpl env) {
26         super();
27         invalidate(env);
28     }
29
30     public RunRecoveryException(EnvironmentImpl env, Throwable JavaDoc t) {
31         super(t);
32         invalidate(env);
33     }
34
35     public RunRecoveryException(EnvironmentImpl env, String JavaDoc message) {
36         super(message);
37         invalidate(env);
38     }
39
40     public RunRecoveryException(EnvironmentImpl env,
41                                 String JavaDoc message, Throwable JavaDoc t) {
42         super(message, t);
43         invalidate(env);
44     }
45
46     private void invalidate(EnvironmentImpl env) {
47     if (env != null) {
48         env.invalidate(this);
49     }
50     }
51
52     /*
53      * Remember that this was already thrown. That way, if we re-throw it
54      * because another handle uses the environment after the fatal throw,
55      * the message is more clear.
56      */

57     public void setAlreadyThrown() {
58         alreadyThrown = true;
59     }
60
61     public String JavaDoc toString() {
62         if (alreadyThrown) {
63             return "Environment invalid because of previous exception: " +
64         super.toString();
65         } else {
66             return super.toString();
67         }
68     }
69 }
70
Popular Tags