graphdb/src/main/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsertBasic.java
public void end() {
    final OClass vClass = db.getMetadata().getSchema().getClass(vertexClass);

    try {

      runningThreads = new AtomicInteger(parallel);
      for (int i = 0; i < parallel - 1; i++) {
        Thread t = new BatchImporterJob(i, vClass);
        t.start();
      }
      Thread t = new BatchImporterJob(parallel - 1, vClass);
      t.run();

      if (runningThreads.get() > 0) {
        synchronized (runningThreads) {
          while (runningThreads.get() > 0) {
            try {
              runningThreads.wait();
            } catch (InterruptedException e) {
            }
          }
        }
      }

    } finally {
      db.activateOnCurrentThread();
      db.declareIntent(null);
      db.close();
      if (walActive)
        OGlobalConfiguration.USE_WAL.setValue(true);
    }
  }
public void end() {
    final OClass vClass = db.getMetadata().getSchema().getClass(vertexClass);

    try {

      runningThreads = new AtomicInteger(parallel);
      for (int i = 0; i < parallel - 1; i++) {
        Thread t = new BatchImporterJob(i, vClass);
        t.start();
      }
      Thread t = new BatchImporterJob(parallel - 1, vClass);
      t.run();

      if (runningThreads.get() > 0) {
        synchronized (runningThreads) {
          while (runningThreads.get() > 0) {
            try {
              runningThreads.wait();
            } catch (InterruptedException e) {
            }
          }
        }
      }

    } finally {
      db.activateOnCurrentThread();
      db.declareIntent(null);
      db.close();
      if (walActive)
        OGlobalConfiguration.USE_WAL.setValue(true);
    }
  }
Flushes data to db and closes the db. Call this once, after vertices and edges creation.