Пример #1
0
 public static Engine createSnapshotFor(Engine engine) {
   if (engine.isReadOnly()) return engine;
   if (engine instanceof TxEngine) return ((TxEngine) engine).snapshot();
   if (engine instanceof EngineWrapper)
     createSnapshotFor(((EngineWrapper) engine).getWrappedEngine());
   throw new UnsupportedOperationException(
       "Snapshots are not enabled, use DBMaker.snapshotEnable()");
 }
Пример #2
0
 /**
  * Make readonly snapshot view of DB and all of its collection Collections loaded by this instance
  * are not affected (are still mutable). You have to load new collections from DB returned by this
  * method
  *
  * @return readonly snapshot view
  */
 public synchronized DB snapshot() {
   Engine snapshot = TxEngine.createSnapshotFor(engine);
   return new DB(snapshot);
 }