@Override public void unbindTransactionFromCurrentThread() { txBridge.unbindTransactionFromCurrentThread(); }
void suspendSinceTransactionsAreStillThreadBound() { assert suspendedTransaction == null : "Can't suspend the transaction if it already is suspended."; suspendedTransaction = bridge.getKernelTransactionBoundToThisThread( true ); bridge.unbindTransactionFromCurrentThread(); }
public void rollback() { try { KernelTransaction kernelTransactionBoundToThisThread = bridge.getKernelTransactionBoundToThisThread( false ); kernelTransactionBoundToThisThread.failure(); kernelTransactionBoundToThisThread.close(); } catch ( TransactionFailureException e ) { throw new RuntimeException( e ); } finally { bridge.unbindTransactionFromCurrentThread(); } }
public void commit() { try { KernelTransaction kernelTransactionBoundToThisThread = bridge.getKernelTransactionBoundToThisThread( true ); kernelTransactionBoundToThisThread.success(); kernelTransactionBoundToThisThread.close(); } catch ( NotInTransactionException e ) { // if the transaction was already terminated there is nothing more to do } catch ( TransactionFailureException e ) { throw new RuntimeException( e ); } finally { bridge.unbindTransactionFromCurrentThread(); } }
private void suspend( Transaction tx ) { ThreadToStatementContextBridge txManager = getTransactionManager(); txMap.put( tx, txManager.getKernelTransactionBoundToThisThread( true ) ); txManager.unbindTransactionFromCurrentThread(); }
@Override public KernelTransaction beginTransaction( KernelTransaction.Type type, LoginContext ignored, long timeout ) { try { availability.assertDatabaseAvailable(); KernelTransaction kernelTx = sourceModule.kernelAPI.get().beginTransaction( type, this.securityContext, timeout ); kernelTx.registerCloseListener( txId -> threadToTransactionBridge.unbindTransactionFromCurrentThread() ); threadToTransactionBridge.bindTransactionToCurrentThread( kernelTx ); return kernelTx; } catch ( TransactionFailureException e ) { throw new org.neo4j.graphdb.TransactionFailureException( e.getMessage(), e ); } } }
@Override public KernelTransaction beginTransaction( KernelTransaction.Type type, LoginContext loginContext, long timeout ) { try { availability.assertDatabaseAvailable(); KernelTransaction kernelTx = dataSource.kernelAPI.get().beginTransaction( type, loginContext, timeout ); kernelTx.registerCloseListener( txId -> threadToTransactionBridge.unbindTransactionFromCurrentThread() ); threadToTransactionBridge.bindTransactionToCurrentThread( kernelTx ); return kernelTx; } catch ( TransactionFailureException e ) { throw new org.neo4j.graphdb.TransactionFailureException( e.getMessage(), e ); } } }
InternalTransaction oldTransaction = transaction; KernelTransaction oldKernelTx = txBridge.getKernelTransactionBoundToThisThread( true ); txBridge.unbindTransactionFromCurrentThread(); statement = kernelTransaction.acquireStatement(); statement.queryRegistration().registerExecutingQuery( executingQuery ); txBridge.unbindTransactionFromCurrentThread(); transaction.failure(); transaction.close(); txBridge.unbindTransactionFromCurrentThread(); throw t; txBridge.unbindTransactionFromCurrentThread(); txBridge.bindTransactionToCurrentThread( kernelTransaction );
order.verify( txBridge ).unbindTransactionFromCurrentThread(); order.verify( secondKTX ).acquireStatement( ); order.verify( secondQueryRegistry ).registerExecutingQuery( executingQuery ); order.verify( txBridge ).unbindTransactionFromCurrentThread(); order.verify( initialTransaction ).success(); order.verify( initialTransaction ).close(); order.verify( txBridge ).unbindTransactionFromCurrentThread();
order.verify( txBridge ).unbindTransactionFromCurrentThread(); order.verify( secondKTX ).acquireStatement(); order.verify( secondQueryRegistry ).registerExecutingQuery( executingQuery ); order.verify( txBridge ).unbindTransactionFromCurrentThread(); order.verify( secondTransaction ).failure(); order.verify( secondTransaction ).close(); order.verify( txBridge ).unbindTransactionFromCurrentThread();
@Override public void unbindTransactionFromCurrentThread() { txBridge.unbindTransactionFromCurrentThread(); }
void suspendSinceTransactionsAreStillThreadBound() { assert suspendedTransaction == null : "Can't suspend the transaction if it already is suspended."; suspendedTransaction = bridge.getKernelTransactionBoundToThisThread( true ); bridge.unbindTransactionFromCurrentThread(); }
private KernelTransaction suspendTx(String query) { if (!isPeriodicCommit(query)) return null; try { KernelTransaction tx = threadToStatementContextBridge.getTopLevelTransactionBoundToThisThread(true); threadToStatementContextBridge.unbindTransactionFromCurrentThread(); return tx; } catch (Exception e) { throw new RuntimeException("Error suspending Transaction",e); } } private void resumeTransaction(KernelTransaction tx) {
public void unbindAndRegisterTransaction( Serializable clientId ) throws ShellException { try { ThreadToStatementContextBridge threadToStatementContextBridge = getThreadToStatementContextBridge(); KernelTransaction tx = threadToStatementContextBridge.getTopLevelTransactionBoundToThisThread( false ); threadToStatementContextBridge.unbindTransactionFromCurrentThread(); if ( tx == null ) { clients.remove( clientId ); } else { clients.put( clientId, tx ); } } catch ( Exception e ) { throw wrapException( e ); } }
public void rollback() { try { KernelTransaction kernelTransactionBoundToThisThread = bridge.getKernelTransactionBoundToThisThread( false ); kernelTransactionBoundToThisThread.failure(); kernelTransactionBoundToThisThread.close(); } catch ( TransactionFailureException e ) { throw new RuntimeException( e ); } finally { bridge.unbindTransactionFromCurrentThread(); } }
public void commit() { try { KernelTransaction kernelTransactionBoundToThisThread = bridge.getKernelTransactionBoundToThisThread( true ); kernelTransactionBoundToThisThread.success(); kernelTransactionBoundToThisThread.close(); } catch ( NotInTransactionException e ) { // if the transaction was already terminated there is nothing more to do } catch ( TransactionFailureException e ) { throw new RuntimeException( e ); } finally { bridge.unbindTransactionFromCurrentThread(); } }
/** Signal to the currently attached client callback that the request has been processed */ private void after() { try { if ( currentCallback != null ) { try { currentCallback.completed( currentAttachment ); } finally { currentCallback = null; currentAttachment = null; } } } finally { if ( hasTransaction() ) { txBridge.unbindTransactionFromCurrentThread(); } } }
/** Signal to the currently attached client callback that the request has been processed */ private void after() { try { if ( currentCallback != null ) { try { currentCallback.completed( currentAttachment ); } finally { currentCallback = null; currentAttachment = null; } } } finally { if ( hasTransaction() ) { txBridge.unbindTransactionFromCurrentThread(); } } }
@Override public KernelTransaction beginTransaction( KernelTransaction.Type type, LoginContext loginContext, long timeout ) { try { availability.assertDatabaseAvailable(); KernelTransaction kernelTx = dataSource.kernelAPI.get().beginTransaction( type, loginContext, timeout ); kernelTx.registerCloseListener( txId -> threadToTransactionBridge.unbindTransactionFromCurrentThread() ); threadToTransactionBridge.bindTransactionToCurrentThread( kernelTx ); return kernelTx; } catch ( TransactionFailureException e ) { throw new org.neo4j.graphdb.TransactionFailureException( e.getMessage(), e ); } } }
@Override public KernelTransaction beginTransaction( KernelTransaction.Type type, LoginContext ignored, long timeout ) { try { availability.assertDatabaseAvailable(); KernelTransaction kernelTx = sourceModule.kernelAPI.get().beginTransaction( type, this.securityContext, timeout ); kernelTx.registerCloseListener( txId -> threadToTransactionBridge.unbindTransactionFromCurrentThread() ); threadToTransactionBridge.bindTransactionToCurrentThread( kernelTx ); return kernelTx; } catch ( TransactionFailureException e ) { throw new org.neo4j.graphdb.TransactionFailureException( e.getMessage(), e ); } } }