Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldIncreaseLastAppliedForStateMachineCommands() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldIncreaseLastAppliedForStateMachineCommands()
        {
            // given
            _raftLog.append(new RaftLogEntry(0, Operation(_nullTx)));
            _raftLog.append(new RaftLogEntry(0, Operation(_nullTx)));
            _raftLog.append(new RaftLogEntry(0, Operation(_nullTx)));

            // when
            _applicationProcess.notifyCommitted(2);
            _applicationProcess.start();

            // then
            assertEquals(2, _applicationProcess.lastApplied());
        }
Exemple #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public synchronized org.neo4j.causalclustering.core.state.snapshot.CoreSnapshot snapshot() throws Exception
        public virtual CoreSnapshot Snapshot()
        {
            lock (this)
            {
                _applicationProcess.pauseApplier(OPERATION_NAME);
                try
                {
                    long lastApplied = _applicationProcess.lastApplied();

                    long         prevTerm     = _raftLog.readEntryTerm(lastApplied);
                    CoreSnapshot coreSnapshot = new CoreSnapshot(lastApplied, prevTerm);

                    _coreState.augmentSnapshot(coreSnapshot);
                    coreSnapshot.Add(CoreStateType.RAFT_CORE_STATE, _raftMachine.coreState());

                    return(coreSnapshot);
                }
                finally
                {
                    _applicationProcess.resumeApplier(OPERATION_NAME);
                }
            }
        }