Repository navigation
Expand file tree
/
Copy pathCC.java
More file actions
154 lines (118 loc) · 4.34 KB
/
Copy pathCC.java
File metadata and controls
154 lines (118 loc) · 4.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* Copyright (c) 2012 Jan Kotek
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mapdb;
/**
* <p>
* Compiler Configuration. There are some static final boolean fields, which describe features MapDB was compiled with.
* </p><p>
*
* MapDB can be compiled with/without some features. For example fine logging is useful for debugging,
* but should not be present in production version. Java does not have preprocessor so
* we use <a href="http://en.wikipedia.org/wiki/Dead_code_elimination">Dead code elimination</a> to achieve it.
* </p><p>
*
* Typical usage:
* </p>
* <pre>{@code
* if(CC.ASSERT && arg.calculateSize()!=33){ //calculateSize may take long time
* throw new IllegalArgumentException("wrong size");
* }
* }</pre>
*
*
* @author Jan Kotek
*/
//TODO add methods to DBMaker to access compiler settings
interface CC {
/**
* Compile with more assertions and verifications.
* For example HashMap may check if keys implements hash function correctly.
* This will slow down MapDB significantly.
*/
boolean ASSERT = true;
boolean PARANOID = false;
/**
* Compile-in detailed log messages from store.
*/
boolean LOG_STORE = false;
/**
* Compile-in detailed log messages from Engine Wrappers
*/
boolean LOG_EWRAP = false;
// /**
// * Log lock/unlock events. Useful to diagnose deadlocks
// */
// boolean LOG_LOCKS = false;
//
// /**
// * If true MapDB will display warnings if user is using MapDB API wrong way.
// */
// boolean LOG_HINTS = true;
/**
* Compile-in detailed log messages from HTreeMap.
*/
boolean LOG_HTREEMAP = false;
/**
* <p>
* Default concurrency level. Should be greater than number of threads accessing
* MapDB concurrently. On other side larger number consumes more memory
* </p><p>
*
* This number must be power of two: {@code CONCURRENCY = 2^N}
* </p>
*/
int DEFAULT_LOCK_SCALE = 16;
// int BTREE_DEFAULT_MAX_NODE_SIZE = 32;
int DEFAULT_CACHE_SIZE = 2048;
String DEFAULT_CACHE = DBMaker.Keys.cache_disable;
/** default executor scheduled rate for {@link org.mapdb.Store.Cache.WeakSoftRef} */
long DEFAULT_CACHE_EXECUTOR_PERIOD = 1000;
int DEFAULT_FREE_SPACE_RECLAIM_Q = 5;
/** controls if locks used in MapDB are fair */
boolean FAIR_LOCKS = false;
int VOLUME_PAGE_SHIFT = 20; // 1 MB
/**
* Will print stack trace of all operations which are write any data at given offset
* Used for debugging.
*/
long VOLUME_PRINT_STACK_AT_OFFSET = 0;
long DEFAULT_HTREEMAP_EXECUTOR_PERIOD = 1000;
long DEFAULT_STORE_EXECUTOR_SCHED_RATE = 1000;
long DEFAULT_METRICS_LOG_PERIOD = 10000;
boolean METRICS_CACHE = true;
boolean METRICS_STORE = true;
int DEFAULT_ASYNC_WRITE_QUEUE_SIZE = 1024;
Volume.VolumeFactory DEFAULT_MEMORY_VOLUME_FACTORY = Volume.ByteArrayVol.FACTORY;
//TODO AppendStoreTest par* test fails if this changes to FileChannelVol
Volume.VolumeFactory DEFAULT_FILE_VOLUME_FACTORY = Volume.RandomAccessFileVol.FACTORY;
/**
* System property <code>h2.maxFileRetry</code> (default: 16).<br />
* Number of times to retry file delete and rename. in Windows, files can't
* be deleted if they are open. Waiting a bit can help (sometimes the
* Windows Explorer opens the files for a short time) may help. Sometimes,
* running garbage collection may close files if the user forgot to call
* Connection.close() or InputStream.close().
*
* TODO H2 specific comment reedit
* TODO file retry is useful, apply MapDB wide
*/
int FILE_RETRY = 16;
/**
* The number of milliseconds to wait between checking the .lock file
* still exists once a db is locked.
*/
int FILE_LOCK_HEARTBEAT = 1000;
}