Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public long commit(org.neo4j.kernel.impl.api.TransactionToApply batch, org.neo4j.kernel.impl.transaction.tracing.CommitEvent commitEvent, org.neo4j.storageengine.api.TransactionApplicationMode mode) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
        public override long Commit(TransactionToApply batch, CommitEvent commitEvent, TransactionApplicationMode mode)
        {
            long txId = _lastLocalTxId.incrementAndGet();

            if (txId > _transactionCounter.lastCommittedTransactionId())
            {
                return(_localCommitProcess.commit(batch, commitEvent, mode));
            }
            return(txId);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public long commit(org.neo4j.kernel.impl.api.TransactionToApply batch, org.neo4j.kernel.impl.transaction.tracing.CommitEvent commitEvent, org.neo4j.storageengine.api.TransactionApplicationMode mode) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
        public override long Commit(TransactionToApply batch, CommitEvent commitEvent, TransactionApplicationMode mode)
        {
            Validate(batch);
            long result = _inner.commit(batch, commitEvent, mode);

            // Assuming all the transactions come from the same author
            int missedReplicas = _txPropagator.committed(result, batch.TransactionRepresentation().AuthorId);

            if (missedReplicas > 0)
            {
                _monitor.missedReplicas(missedReplicas);
            }

            return(result);
        }
        private void TriggerEvent(DefaultTransactionTracer tracer, int eventDuration)
        {
            using (TransactionEvent txEvent = tracer.BeginTransaction())
            {
                using (CommitEvent commitEvent = txEvent.BeginCommitEvent())
                {
                    using (LogAppendEvent logAppendEvent = commitEvent.BeginLogAppend())
                    {
                        _clock.forward(ThreadLocalRandom.current().nextLong(200), TimeUnit.MILLISECONDS);
                        using (LogRotateEvent @event = logAppendEvent.BeginLogRotate())
                        {
                            _clock.forward(eventDuration, TimeUnit.MILLISECONDS);
                        }
                    }
                }
            }

            _jobScheduler.runJob();
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public long commit(org.neo4j.kernel.impl.api.TransactionToApply batch, org.neo4j.kernel.impl.transaction.tracing.CommitEvent commitEvent, org.neo4j.storageengine.api.TransactionApplicationMode mode) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
        public override long Commit(TransactionToApply batch, CommitEvent commitEvent, TransactionApplicationMode mode)
        {
            if (batch.Next() != null)
            {
                throw new System.ArgumentException("Only supports single-commit on slave --> master");
            }

            try
            {
                TransactionRepresentation representation = batch.TransactionRepresentation();
                RequestContext            context        = _requestContextFactory.newRequestContext(representation.LockSessionId);
                using (Response <long> response = _master.commit(context, representation))
                {
                    return(response.ResponseConflict());
                }
            }
            catch (ComException e)
            {
                throw new TransientTransactionFailureException("Cannot commit this transaction on the master. " + "The master is either down, or we have network connectivity problems.", e);
            }
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public long commit(org.neo4j.kernel.impl.api.TransactionToApply tx, org.neo4j.kernel.impl.transaction.tracing.CommitEvent commitEvent, org.neo4j.storageengine.api.TransactionApplicationMode mode) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
            public override long Commit(TransactionToApply tx, CommitEvent commitEvent, TransactionApplicationMode mode)
            {
                LastCommittedTransactionIdConflict++;
                return(CommitProcess.commit(tx, commitEvent, mode));
            }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public long commit(TransactionToApply batch, org.neo4j.kernel.impl.transaction.tracing.CommitEvent commitEvent, org.neo4j.storageengine.api.TransactionApplicationMode mode) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
        public override long Commit(TransactionToApply batch, CommitEvent commitEvent, TransactionApplicationMode mode)
        {
            throw new ReadOnlyDbException();
        }