コード例 #1
0
  /** Close all stores (closing a store automatically closes its indices). */
  public void close() throws DatabaseException {

    // Close secondary databases, then primary databases.
    supplierByCityDb.close();
    shipmentByPartDb.close();
    shipmentBySupplierDb.close();
    partDb.close();
    supplierDb.close();
    shipmentDb.close();
    // And don't forget to close the catalog and the environment.
    javaCatalog.close();
    env.close();
  }
コード例 #2
0
  @After
  public void tearDown() {

    try {
      if (index1 != null) {
        index1.close();
      }
      if (index2 != null) {
        index2.close();
      }
      if (store1 != null) {
        store1.close();
      }
      if (store2 != null) {
        store2.close();
      }
      if (catalog != null) {
        catalog.close();
      }
      if (env != null) {
        env.close();
      }
    } catch (Exception e) {
      System.out.println("Ignored exception during tearDown: " + e);
    } finally {
      /* Ensure that GC can cleanup. */
      env = null;
      testEnv = null;
      catalog = null;
      store1 = null;
      store2 = null;
      index1 = null;
      index2 = null;
      factory = null;
      storeMap1 = null;
      storeMap2 = null;
      indexMap1 = null;
      indexMap2 = null;
    }
  }