コード例 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public TransactionHandle terminate(long id) throws org.neo4j.server.rest.transactional.error.TransactionLifecycleException
        public override TransactionHandle Terminate(long id)
        {
            TransactionMarker marker = _registry[id];

            if (null == marker)
            {
                throw new InvalidTransactionId();
            }

            TransactionTerminationHandle handle = marker.ActiveTransaction.TerminationHandle;

            handle.Terminate();

            try
            {
                SuspendedTransaction transaction = marker.SuspendedTransaction;
                if (_registry.replace(id, marker, marker.ActiveTransaction))
                {
                    return(transaction.TransactionHandle);
                }
            }
            catch (InvalidConcurrentTransactionAccess)
            {
                // We could not acquire the transaction. Let the other request clean up.
            }
            return(null);
        }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: public void rollbackSuspendedTransactionsIdleSince(final long oldestLastActiveTime)
        public virtual void RollbackSuspendedTransactionsIdleSince(long oldestLastActiveTime)
        {
            RollbackSuspended(item =>
            {
                try
                {
                    SuspendedTransaction transaction = item.SuspendedTransaction;
                    return(transaction.LastActiveTimestampConflict < oldestLastActiveTime);
                }
                catch (InvalidConcurrentTransactionAccess concurrentTransactionAccessError)
                {
                    throw new Exception(concurrentTransactionAccessError);
                }
            });
        }
コード例 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public TransactionHandle acquire(long id) throws org.neo4j.server.rest.transactional.error.TransactionLifecycleException
        public override TransactionHandle Acquire(long id)
        {
            TransactionMarker marker = _registry[id];

            if (null == marker)
            {
                throw new InvalidTransactionId();
            }

            SuspendedTransaction transaction = marker.SuspendedTransaction;

            if (_registry.replace(id, marker, marker.ActiveTransaction))
            {
                return(transaction.TransactionHandle);
            }
            else
            {
                throw new InvalidConcurrentTransactionAccess();
            }
        }
コード例 #4
0
        public override long Release(long id, TransactionHandle transactionHandle)
        {
            TransactionMarker marker = _registry[id];

            if (null == marker)
            {
                throw new System.InvalidOperationException("Trying to suspend unregistered transaction");
            }

            if (marker.Suspended)
            {
                throw new System.InvalidOperationException("Trying to suspend transaction that was already suspended");
            }

            SuspendedTransaction suspendedTx = new SuspendedTransaction(this, marker.ActiveTransaction, transactionHandle);

            if (!_registry.replace(id, marker, suspendedTx))
            {
                throw new System.InvalidOperationException("Trying to suspend transaction that has been concurrently suspended");
            }
            return(ComputeNewExpiryTime(suspendedTx.LastActiveTimestamp));
        }