in activeio-core/src/main/java/org/apache/activeio/journal/active/ControlFile.java [106:142]
public boolean load() throws IOException {
long l = file.length();
if( l < controlData.capacity() ) {
controlDataVersion=0;
controlData.position(0);
controlData.limit(0);
return false;
} else {
file.seek(0);
long v1 = file.readLong();
file.seek(controlData.capacity()+8);
long v1check = file.readLong();
file.seek(controlData.capacity()+16);
long v2 = file.readLong();
file.seek((controlData.capacity()*2)+24);
long v2check = file.readLong();
if( v2 == v2check ) {
controlDataVersion = v2;
file.seek(controlData.capacity()+24);
controlData.clear();
channel.read(controlData.getByteBuffer());
} else if ( v1 == v1check ){
controlDataVersion = v1;
file.seek(controlData.capacity()+8);
controlData.clear();
channel.read(controlData.getByteBuffer());
} else {
// Bummer.. Both checks are screwed. we don't know
// if any of the two buffer are ok. This should
// only happen is data got corrupted.
throw new IOException("Control data corrupted.");
}
return true;
}
}