*/
private MappedByteBuffer map(final long page) {
if(_channel == null) {
ensureOpen();
}
MappedByteBuffer buf;
try {
buf = _channel.map(_readOnly ? MapMode.READ_ONLY : MapMode.READ_WRITE, page, _pageSize);
} catch (IOException e) {// silly workaround for JDK bug #4724038
System.gc();
System.runFinalization();
try {
buf = _channel.map(_readOnly ? MapMode.READ_ONLY : MapMode.READ_WRITE, page, _pageSize);
} catch (IOException ioe) {
throw new IllegalStateException("map failed for page#" + page + " of file: "
+ _filepath, ioe);
}
}
if(_setAsLittleEndian) {// BIG_ENDIAN by the default
buf.order(ByteOrder.LITTLE_ENDIAN);
}
return buf;
}