Repository navigation
Expand file tree
/
Copy pathDBException.java
More file actions
179 lines (143 loc) · 5.09 KB
/
Copy pathDBException.java
File metadata and controls
179 lines (143 loc) · 5.09 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
package org.mapdb;
import java.io.File;
import java.io.IOException;
import java.nio.channels.ClosedByInterruptException;
/**
* General exception returned by MapDB if something goes wrong.
* Subclasses inform about specific failure.
*
*/
public class DBException extends RuntimeException{
public DBException(String message) {
super(message);
}
public DBException(String message, Throwable cause) {
super(message,cause);
}
public DBException() {
super();
}
public static class EngineGetVoid extends DBException{
public EngineGetVoid(){
super("Recid passed to Engine.get() does not exist. Possible data corruption!");
}
}
public static class EngineCompactUncommited extends DBException{
public EngineCompactUncommited(){
super("Engine.compact() called while there are uncommited data. Commit first, than compact!");
}
}
/** @see java.nio.channels.ClosedByInterruptException */
//TODO this thread was interrupted while doing IO?
public static class VolumeClosedByInterrupt extends VolumeClosed{
public VolumeClosedByInterrupt(ClosedByInterruptException cause){
super("Some thread was interrupted while doing IO, and FileChannel was closed in result.", cause);
}
}
public static class VolumeClosed extends DBException{
public VolumeClosed(IOException cause){
this("Volume (file or other device) was already closed.", cause);
}
protected VolumeClosed(String msg, IOException cause) {
super(msg,cause);
}
}
/** Some other process (possibly DB) holds exclusive lock over this file, so it can not be opened */
public static class FileLocked extends DBException{
public FileLocked(String message) {
super(message);
}
public FileLocked(String message, Throwable cause) {
super(message,cause);
}
}
public static class VolumeIOError extends DBException{
public VolumeIOError(String msg){
super(msg);
}
public VolumeIOError(String msg, Throwable cause){
super(msg, cause);
}
public VolumeIOError(Throwable cause){
super("IO failed", cause);
}
}
public static class VolumeEOF extends VolumeIOError {
public VolumeEOF() {
this("Beyond End Of File accessed");
}
public VolumeEOF(String s) {
super(s);
}
}
public static class OutOfMemory extends VolumeIOError{
public OutOfMemory(Throwable e){
super(
e.getMessage().equals("Direct buffer memory")?
"Out of Direct buffer memory. Increase it with JVM option '-XX:MaxDirectMemorySize=10G'":
e.getMessage(),
e);
}
}
public static class DataCorruption extends DBException{
public DataCorruption(String msg){
super(msg);
}
public DataCorruption() {
super();
}
}
public static class ChecksumBroken extends DataCorruption{
public ChecksumBroken(){
super("CRC checksum is broken");
}
}
public static class HeadChecksumBroken extends DataCorruption{
public HeadChecksumBroken(){
super("Head checksum broken, perhaps db was not closed correctly?");
}
}
public static class PointerChecksumBroken extends DataCorruption{
public PointerChecksumBroken(){
super("Bit parity in file pointer is broken, data possibly corrupted.");
}
}
public static class Interrupted extends DBException {
public Interrupted(InterruptedException e) {
super("Thread interrupted",e);
}
}
public static class PumpSourceDuplicate extends DBException {
public PumpSourceDuplicate(Object key) {
super("Duplicate found, use .pumpIgnoreDuplicates() to ignore. Duplicate key:"+key);
}
}
public static class PumpSourceNotSorted extends DBException {
public PumpSourceNotSorted() {
super("Source iterator not sorted, use .pumpPresort(10000000) to sort keys.");
}
}
public static class WrongConfig extends DBException{
public WrongConfig(String message) {
super(message);
}
public WrongConfig(String message, Throwable cause) {
super(message,cause);
}
}
public static class UnknownSerializer extends DBException{
public UnknownSerializer(String message) {
super(message);
}
}
public static class FileDeleteFailed extends DBException {
public FileDeleteFailed(File file) {
super("Could not delete file: "+file);
}
}
public static class VolumeMaxSizeExceeded extends DBException {
public VolumeMaxSizeExceeded(long length, long requestedLength) {
super("Could not expand store. Maximal store size: "+length+", new requested size: "+requestedLength);
}
}
}