KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > Debug


1 /* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com
2
3 This file is part of the db4o open source object database.
4
5 db4o is free software; you can redistribute it and/or modify it under
6 the terms of version 2 of the GNU General Public License as published
7 by the Free Software Foundation and as clarified by db4objects' GPL
8 interpretation policy, available at
9 http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
10 Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
11 Suite 350, San Mateo, CA 94403, USA.
12
13 db4o is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */

21 package com.db4o;
22
23 import com.db4o.foundation.*;
24
25 /**
26  * @exclude
27  */

28 public abstract class Debug extends Debug4 {
29     
30     public static final boolean indexAllFields = false;
31     
32     public static final boolean queries = false;
33
34     public static final boolean atHome = false;
35
36     public static boolean longTimeOuts = false;
37
38     public static final boolean freespace = Deploy.debug ? true :false;
39     
40     public static final boolean xbytes = freespace ? true : false;
41     
42     public static final boolean freespaceChecker = false;
43     
44     public static final boolean checkSychronization = false;
45     
46     public static final boolean configureAllClasses = indexAllFields;
47     public static final boolean configureAllFields = indexAllFields;
48     
49     public static final boolean weakReferences = true;
50
51     public static final boolean fakeServer = false;
52     
53     public static final boolean messages = false;
54
55     public static final boolean nio = true;
56     
57     public static final boolean lockFile = true;
58
59     public static void expect(boolean cond){
60         if(! cond){
61             throw new RuntimeException JavaDoc("Should never happen");
62         }
63     }
64     
65     public static void ensureLock(Object JavaDoc obj) {
66         if (atHome) {
67             try {
68                 obj.wait(1);
69             } catch (IllegalMonitorStateException JavaDoc imse) {
70                 System.err.println("No Lock Alarm.");
71                 imse.printStackTrace();
72             } catch (Exception JavaDoc e) {
73                 e.printStackTrace();
74             }
75         }
76     }
77
78     public static boolean exceedsMaximumBlockSize(int a_length) {
79         if (a_length > YapConst.MAXIMUM_BLOCK_SIZE) {
80             if (atHome) {
81                 System.err.println("Maximum block size exceeded!!!");
82                 new Exception JavaDoc().printStackTrace();
83             }
84             return true;
85         }
86         return false;
87     }
88     
89     public static boolean exceedsMaximumArrayEntries(int a_entries, boolean a_primitive){
90         if (a_entries > (a_primitive ? YapConst.MAXIMUM_ARRAY_ENTRIES_PRIMITIVE : YapConst.MAXIMUM_ARRAY_ENTRIES)) {
91             if (atHome) {
92                 System.err.println("Maximum array elements exceeded!!!");
93                 new Exception JavaDoc().printStackTrace();
94             }
95             return true;
96         }
97         return false;
98     }
99 }
100
Popular Tags