/** * Perform a bulk read operation * @return a list of response codes * @throws Exception */ public List<String> readBulk(final List<String> keys) throws Exception { List<String> responses = new ArrayList<>(keys.size()); JanusGraphTransaction transaction = useJanusgraphTransaction ? graph.newTransaction() : null; try { for (String key : keys) { String response = readSingleInternal(key, transaction); responses.add(response); } } finally { if (transaction != null) transaction.close(); } return responses; }
@Override public String readSingle(String key) throws Exception { JanusGraphTransaction tx = useJanusgraphTransaction ? graph.newTransaction() : null; try { return readSingleInternal(key, tx); } finally { if (tx != null) tx.close(); } }
@Override public void run() { log.info("Starting new thread " + myID); // Start new graph transaction graphTransaction = getGraph().newTransaction(); getRecords().forEachRemaining(new Consumer<Map<String, String>>() { @Override public void accept(Map<String, String> record) { try { acceptRecord(record); } catch (Exception e) { log.error("Thread " + myID + ". Exception during record import.", e); } } }); graphTransaction.commit(); graphTransaction.close(); log.info("Finished thread " + myID); notifyListener(WorkerListener.State.Done); }
graphTransaction.close(); graphTransaction = getGraph().newTransaction(); traversal = graphTransaction.traversal();
@Override public void run() { log.info("Starting new thread " + myID); // Start new graph transaction graphTransaction = getGraph().newTransaction(); this.traversal = graphTransaction.traversal(); getRecords().forEachRemaining(new Consumer<Map<String, String>>() { @Override public void accept(Map<String, String> record) { try { acceptRecord(record); } catch (Exception e) { log.error("Thread " + myID + ". Exception during record import.", e); } } }); graphTransaction.commit(); graphTransaction.close(); graphTransaction = null; log.info("Finished thread " + myID); notifyListener(WorkerListener.State.Done); } }
graphTransaction.close(); graphTransaction = getGraph().newTransaction();