Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSendPullRequestOnTick() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSendPullRequestOnTick()
        {
            // given
            _txPuller.start();
            long lastAppliedTxId = 99L;

            when(_txApplier.lastQueuedTxId()).thenReturn(lastAppliedTxId);

            // when
            _timerService.invoke(TX_PULLER_TIMER);

            // then
            verify(_catchUpClient).makeBlockingRequest(any(typeof(AdvertisedSocketAddress)), any(typeof(TxPullRequest)), any(typeof(CatchUpResponseCallback)));
        }
Esempio n. 2
0
        private bool PullAndApplyBatchOfTransactions(MemberId upstream, StoreId localStoreId, int batchCount)
        {
            long lastQueuedTxId = _applier.lastQueuedTxId();

            _pullRequestMonitor.txPullRequest(lastQueuedTxId);
            TxPullRequest txPullRequest = new TxPullRequest(lastQueuedTxId, localStoreId);

            _log.debug("Pull transactions from %s where tx id > %d [batch #%d]", upstream, lastQueuedTxId, batchCount);

            TxStreamFinishedResponse response;

            try
            {
                AdvertisedSocketAddress fromAddress = _topologyService.findCatchupAddress(upstream).orElseThrow(() => new TopologyLookupException(upstream));
                response = _catchUpClient.makeBlockingRequest(fromAddress, txPullRequest, new CatchUpResponseAdaptorAnonymousInnerClass(this, response));
            }
            catch (Exception e) when(e is CatchUpClientException || e is TopologyLookupException)
            {
                _log.warn("Exception occurred while pulling transactions. Will retry shortly.", e);
                StreamComplete();
                return(false);
            }

            _latestTxIdOfUpStream = response.LatestTxId();

            switch (response.Status())
            {
            case SUCCESS_END_OF_STREAM:
                _log.debug("Successfully pulled transactions from tx id %d", lastQueuedTxId);
                _upToDateFuture.complete(true);
                return(false);

            case E_TRANSACTION_PRUNED:
                _log.info("Tx pull unable to get transactions starting from %d since transactions have been pruned. Attempting a store copy.", lastQueuedTxId);
                _state = STORE_COPYING;
                return(false);

            default:
                _log.info("Tx pull request unable to get transactions > %d " + lastQueuedTxId);
                return(false);
            }
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHaveCorrectDefaults()
        public virtual void ShouldHaveCorrectDefaults()
        {
            assertEquals(_startTxId, _txApplier.lastQueuedTxId());
        }