Beispiel #1
0
 private void createAccounts()
     throws IOException, DeadlockException, InterruptedException, TransactionRolledBackException {
   for (int a = 0; a < nAccounts; a++) {
     Account account = new Account(new AccountId(a));
     account.balance(0);
     accounts.ensurePresent(account);
   }
   db.commitTransaction();
 }
Beispiel #2
0
 private void verify() throws IOException, InterruptedException {
   long sum = 0;
   Cursor cursor = accounts.first();
   Account account;
   while ((account = (Account) cursor.next()) != null) {
     LOG.log(Level.INFO, "{0}", account);
     sum += account.balance();
   }
   db.commitTransaction();
   if (sum == 0) {
     LOG.log(Level.INFO, "OK!");
   } else {
     LOG.log(Level.WARNING, "Test failed, sum = {0}", sum);
   }
 }