コード例 #1
0
 private void testRemoveAndFetch(final boolean inTransaction) throws Exception {
   final Exchange ex = _persistit.getExchange("persistit", "gogo", true);
   final Transaction txn = ex.getTransaction();
   ex.getValue().put(RED_FOX);
   for (int i = 1; i < 10000; i++) {
     if (inTransaction) {
       txn.begin();
     }
     ex.to(i).store();
     if (inTransaction) {
       txn.commit();
       txn.end();
     }
   }
   for (int i = 1; i < 10000; i++) {
     if (inTransaction) {
       txn.begin();
     }
     ex.getValue().clear();
     ex.to(i).fetchAndRemove();
     assertTrue("A value was fetched", ex.getValue().isDefined());
     if (inTransaction) {
       txn.commit();
       txn.end();
     }
   }
 }