public static class DBMaker.Maker
Constructor and Description |
---|
Maker(DBMaker.StoreType _storeType,
Volume _customVolume,
java.lang.Boolean _volumeExist,
java.lang.String file) |
Modifier and Type | Method and Description |
---|---|
DBMaker.Maker |
allocateIncrement(long incrementSize) |
DBMaker.Maker |
allocateStartSize(long size) |
void |
assertFile() |
DBMaker.Maker |
checksumHeaderBypass()
MapDB detects unclean shutdown (and possible data corruption) by Header Checksum.
This checksum becomes invalid if store was modified, but not closed correctly.
In that case MapDB will throw an exception and will refuse to open the store.
|
DBMaker.Maker |
checksumStoreEnable()
Enables store wide checksum. Entire file is covered by 64bit checksum to catch possible data corruption.
This could be slow, since entire file is traversed to calculate checksum on store open, commit and close.
|
DBMaker.Maker |
cleanerHackEnable() |
DBMaker.Maker |
closeOnJvmShutdown()
Adds JVM shutdown hook and closes DB just before JVM;
|
DBMaker.Maker |
closeOnJvmShutdownWeakReference()
Adds JVM shutdown hook and closes DB just before JVM.
This is similar to
closeOnJvmShutdown() , but DB is referenced with WeakReference from shutdown hook
and can be GCed. That might prevent memory leaks under some conditions, but does not guarantee DB will be actually closed. |
DBMaker.Maker |
concurrencyDisable()
WARNING: this option is dangerous. With locks disabled multi-threaded access could cause data corruption and causes.
MapDB does not have fail-fast iterator or any other means of protection
|
DBMaker.Maker |
concurrencyScale(int segmentCount)
This value has to be power of two, so it is rounded up automatically.
|
DBMaker.Maker |
deleteFilesAfterClose()
Deprecated.
|
DBMaker.Maker |
executorEnable()
Enables background executor
|
DBMaker.Maker |
fileChannelEnable()
Enable FileChannel access. By default MapDB uses {@link java.io.RandomAccessFile}.
whic is slower and more robust. but does not allow concurrent access (parallel read and writes). RAF is still thread-safe
but has global lock.
FileChannel does not have global lock, and is faster compared to RAF. However memory-mapped files are
probably best choice.
|
DBMaker.Maker |
fileDeleteAfterClose() |
DBMaker.Maker |
fileDeleteAfterOpen() |
DBMaker.Maker |
fileLockDisable() |
DBMaker.Maker |
fileLockWait(long timeout) |
DBMaker.Maker |
fileLockWait() |
DBMaker.Maker |
fileMmapEnable()
You may experience {@code java.lang.OutOfMemoryError: Map failed} exception on 32bit JVM, if you enable this
mode.
|
DBMaker.Maker |
fileMmapEnableIfSupported()
Enable Memory Mapped Files only if current JVM supports it (is 64bit).
|
DBMaker.Maker |
fileMmapPreclearDisable() |
DB |
make() |
DBMaker.Maker |
readOnly()
Open store in read-only mode. Any modification attempt will throw
UnsupportedOperationException("Read-only")
|
DBMaker.Maker |
transactionEnable() |
public Maker(DBMaker.StoreType _storeType, Volume _customVolume, java.lang.Boolean _volumeExist, java.lang.String file)
public DBMaker.Maker transactionEnable()
public DBMaker.Maker allocateStartSize(long size)
public DBMaker.Maker allocateIncrement(long incrementSize)
public DBMaker.Maker deleteFilesAfterClose()
public DBMaker.Maker fileDeleteAfterClose()
public DBMaker.Maker fileDeleteAfterOpen()
public DBMaker.Maker executorEnable()
Enables background executor
public DBMaker.Maker concurrencyDisable()
WARNING: this option is dangerous. With locks disabled multi-threaded access could cause data corruption and causes. MapDB does not have fail-fast iterator or any other means of protection
public DBMaker.Maker concurrencyScale(int segmentCount)
This value has to be power of two, so it is rounded up automatically.
public void assertFile()
public DBMaker.Maker fileMmapEnable()
You may experience {@code java.lang.OutOfMemoryError: Map failed} exception on 32bit JVM, if you enable this mode.
public DBMaker.Maker cleanerHackEnable()
public DBMaker.Maker fileMmapPreclearDisable()
public DBMaker.Maker fileLockDisable()
public DBMaker.Maker fileLockWait(long timeout)
public DBMaker.Maker fileLockWait()
public DBMaker.Maker checksumStoreEnable()
Enables store wide checksum. Entire file is covered by 64bit checksum to catch possible data corruption. This could be slow, since entire file is traversed to calculate checksum on store open, commit and close.
public DBMaker.Maker checksumHeaderBypass()
MapDB detects unclean shutdown (and possible data corruption) by Header Checksum. This checksum becomes invalid if store was modified, but not closed correctly. In that case MapDB will throw an exception and will refuse to open the store.
public DBMaker.Maker fileMmapEnableIfSupported()
Enable Memory Mapped Files only if current JVM supports it (is 64bit).
public DBMaker.Maker fileChannelEnable()
Enable FileChannel access. By default MapDB uses {@link java.io.RandomAccessFile}. whic is slower and more robust. but does not allow concurrent access (parallel read and writes). RAF is still thread-safe but has global lock. FileChannel does not have global lock, and is faster compared to RAF. However memory-mapped files are probably best choice.
public DBMaker.Maker closeOnJvmShutdown()
Adds JVM shutdown hook and closes DB just before JVM;
public DBMaker.Maker closeOnJvmShutdownWeakReference()
Adds JVM shutdown hook and closes DB just before JVM.
This is similar to closeOnJvmShutdown()
, but DB is referenced with WeakReference
from shutdown hook
and can be GCed. That might prevent memory leaks under some conditions, but does not guarantee DB will be actually closed.
DB.close()
removes DB object from shutdown hook, so DB object can be GCed after close, even with regular
public DBMaker.Maker readOnly()
Open store in read-only mode. Any modification attempt will throw UnsupportedOperationException("Read-only")
public DB make()