Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void successfulRetriesBreakTheRetryLoop()
        public virtual void SuccessfulRetriesBreakTheRetryLoop()
        {
            CountingSleeper countingSleeper       = new CountingSleeper();
            int             retries               = 5;
            MultiRetryStrategy <int, int> subject = new MultiRetryStrategy <int, int>(0, retries, NullLogProvider.Instance, countingSleeper);

            // when
            subject.Apply(3, System.Func.identity(), VALID_ON_SECOND_TIME);

            // then
            assertEquals(1, countingSleeper.InvocationCount());
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void numberOfIterationsDoesNotExceedMaximum()
        public virtual void NumberOfIterationsDoesNotExceedMaximum()
        {
            // given
            CountingSleeper countingSleeper       = new CountingSleeper();
            int             retries               = 5;
            MultiRetryStrategy <int, int> subject = new MultiRetryStrategy <int, int>(0, retries, NullLogProvider.Instance, countingSleeper);

            // when
            subject.Apply(3, System.Func.identity(), _neverValid);

            // then
            assertEquals(retries, countingSleeper.InvocationCount());
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void successOnRetryCausesNoDelay()
        public virtual void SuccessOnRetryCausesNoDelay()
        {
            // given
            CountingSleeper countingSleeper       = new CountingSleeper();
            int             retries               = 10;
            MultiRetryStrategy <int, int> subject = new MultiRetryStrategy <int, int>(0, retries, NullLogProvider.Instance, countingSleeper);

            // when
            int?result = subject.Apply(3, System.Func.identity(), _alwaysValid);

            // then
            assertEquals(0, countingSleeper.InvocationCount());
            assertEquals("Function identity should be used to retrieve the expected value", 3, result.Value);
        }
Ejemplo n.º 4
0
 internal RetryingHostnameResolver(Config config, MultiRetryStrategy <AdvertisedSocketAddress, ICollection <AdvertisedSocketAddress> > retryStrategy)
 {
     _minResolvedAddresses = config.Get(CausalClusteringSettings.minimum_core_cluster_size_at_formation);
     this._retryStrategy   = retryStrategy;
 }
Ejemplo n.º 5
0
 internal DnsHostnameResolver(LogService logService, DomainNameResolver domainNameResolver, Config config, MultiRetryStrategy <AdvertisedSocketAddress, ICollection <AdvertisedSocketAddress> > retryStrategy) : base(config, retryStrategy)
 {
     _log     = logService.GetInternalLog(this.GetType());
     _userLog = logService.GetUserLog(this.GetType());
     this._domainNameResolver = domainNameResolver;
 }
Ejemplo n.º 6
0
 internal SrvHostnameResolver(LogService logService, SrvRecordResolver srvRecordResolver, Config config, MultiRetryStrategy <AdvertisedSocketAddress, ICollection <AdvertisedSocketAddress> > retryStrategy) : base(config, retryStrategy)
 {
     _log     = logService.GetInternalLog(this.GetType());
     _userLog = logService.GetUserLog(this.GetType());
     this._srvRecordResolver = srvRecordResolver;
 }