@Override public void close() { tx().close(); }
@Override public void close() { tx().close(); }
/** * This implementation of {@code close} will also close the current transaction on the thread, but it * is up to the caller to deal with dangling transactions in other threads prior to calling this method. */ @Override public void close() throws Exception { this.tx().close(); if (this.baseGraph != null) this.baseGraph.shutdown(); }
latch.countDown(); graph.addVertex(); graph.tx().close(); });
@Test @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) @FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_TRANSACTIONS) @FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_PERSISTENCE) public void shouldCommitOnCloseWhenConfigured() throws Exception { final AtomicReference<Object> oid = new AtomicReference<>(); final Thread t = new Thread(() -> { final Vertex v1 = graph.addVertex("name", "marko"); g.tx().onClose(Transaction.CLOSE_BEHAVIOR.COMMIT); oid.set(v1.id()); graph.tx().close(); }); t.start(); t.join(); final Vertex v2 = graph.vertices(oid.get()).next(); assertEquals("marko", v2.<String>value("name")); }
@Test @FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = FEATURE_TRANSACTIONS) public void shouldHaveExceptionConsistencyWhenTransactionOpenOnClose() { g.tx().onClose(Transaction.CLOSE_BEHAVIOR.MANUAL); if (!g.tx().isOpen()) g.tx().open(); try { graph.tx().close(); fail("An exception should be thrown when close behavior is manual and the graph is close with an open transaction"); } catch (Exception ex) { validateException(Transaction.Exceptions.openTransactionsOnClose(), ex); } finally { // rollback manually to keep the test clean g.tx().rollback(); } }
@Override public void close() { this.getDelegate().close(); }
@Override public void finishWriting() { tx.commit(); tx.close(); LOG.info("Finish writing"); } }
@Override public void close() { this.getDelegate().close(); }
@Test @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) @FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_TRANSACTIONS) public void shouldAllowReferenceOfVertexOutsideOfOriginalTransactionalContextManual() { g.tx().onReadWrite(Transaction.READ_WRITE_BEHAVIOR.MANUAL); g.tx().open(); final Vertex v1 = graph.addVertex("name", "stephen"); g.tx().commit(); g.tx().open(); assertEquals("stephen", v1.value("name")); g.tx().rollback(); g.tx().open(); assertEquals("stephen", v1.value("name")); g.tx().close(); }
@Test @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE) @FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_TRANSACTIONS) public void shouldAllowReferenceOfEdgeOutsideOfOriginalTransactionalContextManual() { g.tx().onReadWrite(Transaction.READ_WRITE_BEHAVIOR.MANUAL); g.tx().open(); final Vertex v1 = graph.addVertex(); final Edge e = v1.addEdge("self", v1, "weight", 0.5d); g.tx().commit(); g.tx().open(); assertEquals(0.5d, e.value("weight"), 0.00001d); g.tx().rollback(); g.tx().open(); assertEquals(0.5d, e.value("weight"), 0.00001d); g.tx().close(); }
@Override public void close() throws IOException { tx().close(); if (baseGraph != null) { baseGraph.close(); } }
private void commit() { if (++numberOfEntriesWithoutCommit >= 5000) { numberOfEntriesWithoutCommit = 0; tx.commit(); tx.close(); tx.open(); } }
/** * This implementation of {@code close} will also close the current transaction on the thread, but it * is up to the caller to deal with dangling transactions in other threads prior to calling this method. */ @Override public void close() throws Exception { this.tx().close(); if (this.baseGraph != null) this.baseGraph.shutdown(); }
@Override protected void closeGraphTransaction() throws Exception { getTinkerPopGraph().tx().close(); } }
private void closeTransaction(String closedReason) { try { graph.tx().close(); } catch (UnsupportedOperationException e) { //Ignored for Tinker } finally { txCache().closeTx(closedReason); ruleCache().closeTx(); } }
@Override public void close() { Tx.setActive(null); if (isSuccess()) { commit(); } else { rollback(); } getDelegate().close(); }
@Override public void filter(final ContainerRequestContext requestContext, final ContainerResponseContext responseContext) { if (graphWrapper.getGraph().tx().isOpen()) { if (isSafeMethod(requestContext.getMethod())) { LOG.error("Dangling transaction, you might have lost data! (closing it, causing a rollback)"); } graphWrapper.getGraph().tx().close(); } }
@Override public void close() { Tx.setActive(null); if (isSuccess()) { commit(); } else { rollback(); } getDelegate().close(); }
private void closeTitan(){ StandardTitanGraph graph = (StandardTitanGraph) getTinkerPopGraph(); synchronized (graph) { //Have to block here because the list of open transactions in Titan is not thread safe. if(graph.tx().isOpen()) graph.tx().close(); if (graph.getOpenTxs() == 0) { closePermanent(); } } } }