Since version 4.6 DEX comes with an automatic recovery manager. The recovery will always keep save your database no matter any eventuality.
If you wish to use the recovery you must activate it using the DexConfig class or the config file.
You need to enable it using the DexConfig class:
DexConfig cfg = new DexConfig();
cfg.setRecoveryEnabled(true);
Dex dex = new Dex(cfg);
Or you can add this property to the dex config file:
nce the recovery is activated there are some other adjustments that could be handy. These additional DexConfig methods can be used to tune the recovery:
- setRecoveryLogFile(java.lang.String v): Changes the file used to store the recovery log.
- setRecoveryCacheMaxSize(int v): Sets the maximum size for the recovery log cache.
- setRecoveryCheckpointTime(int v): Sets the delay time (in seconds) between automatic checkpoints.
Or the corresponting properties in the dex config file:
dex.io.recovery.logfile
dex.io.recovery.cachesize
dex.io.recovery.checkpointTime
Please take into account that a minor lack in performance may appear while the recovery is on.