@Test public void stack_persisted(){ File f = Utils.tempDbFile(); DB db = DBMaker.newFileDB(f).journalDisable().cacheDisable().asyncWriteDisable().make(); Queue<Object> stack = db.getStack("test"); stack.add("1"); stack.add("2"); stack.add("3"); stack.add("4"); db.close(); db = DBMaker.newFileDB(f).journalDisable().cacheDisable().asyncWriteDisable().deleteFilesAfterClose().make(); stack = db.getStack("test"); assertEquals("4",stack.poll()); assertEquals("3",stack.poll()); assertEquals("2",stack.poll()); assertEquals("1",stack.poll()); assertNull(stack.poll()); db.close(); }
static <E> Stack<E> getStack(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){ StackRoot root = engine.get(rootRecid, new StackRootSerializer(serializerSerializer)); return new Stack<E>(engine, root.serializer, root.headerRecid, root.useLocks); }
Queues { static <E> Stack<E> getStack(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){ StackRoot root = engine.get(rootRecid, new StackRootSerializer(serializerSerializer)); return new Stack<E>(engine, root.serializer, root.headerRecid, root.useLocks); } }
Queues { static <E> Stack<E> getStack(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){ StackRoot root = engine.get(rootRecid, new StackRootSerializer(serializerSerializer)); return new Stack<E>(engine, root.serializer, root.headerRecid, root.useLocks); } private  Queues(); }
Queues { static <E> Stack<E> getStack(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){ StackRoot root = engine.get(rootRecid, new StackRootSerializer(serializerSerializer)); return new Stack<E>(engine, root.serializer, root.headerRecid, root.useLocks); } private  Queues();  }
Queues { static <E> Stack<E> getStack(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){ StackRoot root = engine.get(rootRecid, new StackRootSerializer(serializerSerializer)); return new Stack<E>(engine, root.serializer, root.headerRecid, root.useLocks); } private  Queues();   }