Esempio n. 1
0
  /**
   * Run two transactions to populate and print the database. A TransactionRunner is used to ensure
   * consistent handling of transactions, including deadlock retries. But the best transaction
   * handling mechanism to use depends on the application.
   */
  private void run() throws Exception {

    TransactionRunner runner = new TransactionRunner(db.getEnvironment());
    runner.run(new PopulateDatabase());
    runner.run(new PrintDatabase());
  }
Esempio n. 2
0
  /** Close the database cleanly. */
  private void close() throws DatabaseException {

    db.close();
  }