示例#1
0
 public MessageQueue(StorageAccount account, IRetryPolicyFactory retryPolicyFactory, string queueName, TimeSpan visibilityTimeout) : base(retryPolicyFactory)
 {
     Trace.WriteLine(string.Format("Called constructor in MessageQueue with account={0}, queueName={1}, visibilityTimeout={2}", account.ConnectionString, queueName, visibilityTimeout.Seconds), "UNITY");
     this.account           = account;
     this.queue             = queueName;
     this.visibilityTimeout = visibilityTimeout;
 }
 public ClientCollectionCache(ISessionContainer sessionContainer, IStoreModel storeModel, ICosmosAuthorizationTokenProvider tokenProvider, IRetryPolicyFactory retryPolicy)
 {
     this.storeModel       = storeModel ?? throw new ArgumentNullException("storeModel");
     this.tokenProvider    = tokenProvider;
     this.retryPolicy      = retryPolicy;
     this.sessionContainer = sessionContainer;
 }
示例#3
0
 public FilesBlobContainer(StorageAccount account, IRetryPolicyFactory retryPolicyFactory, string containerName, string contentType) : base(retryPolicyFactory)
 {
     Trace.WriteLine(string.Format("Called constructor in FilesBlobContainer with account={0}, blobContainerName={1}, contentType={2}", account.ConnectionString, containerName, contentType), "UNITY");
     this.Account     = account;
     this.Container   = containerName;
     this.contentType = contentType;
 }
示例#4
0
 public DataTable(StorageAccount account, IRetryPolicyFactory retryPolicyFactory, string tableName)
     : base(retryPolicyFactory)
 {
     Trace.WriteLine(string.Format("Called constructor in DataTable with account={0}, tableName={1}", account.ConnectionString, tableName), "UNITY");
     this.account   = account;
     this.tableName = tableName;
 }
示例#5
0
        public RetryHandler(IRetryPolicyFactory retryPolicyFactory)
        {
            if (retryPolicyFactory == null)
            {
                throw new ArgumentNullException(nameof(retryPolicyFactory));
            }

            this.retryPolicyFactory = retryPolicyFactory;
        }
 private VersionedPropertyStore(
     TraceType traceType,
     Uri storeName,
     IPropertyManagerWrapper propertyManager,
     IRetryPolicyFactory retryPolicyFactory)
 {
     this.traceType          = traceType;
     this.storeName          = storeName;
     this.propertyManager    = propertyManager;
     this.retryPolicyFactory = retryPolicyFactory;
 }
示例#7
0
        public ServiceFabricRepairManagerFactory(CoordinatorEnvironment environment, IActivityLogger activityLogger)
        {
            this.activityLogger = activityLogger.Validate("activityLogger");
            this.fabricClient   = new FabricClient();
            this.environment    = environment.Validate("environment");

            this.retryPolicyFactory = new LinearRetryPolicyFactory(
                environment.DefaultTraceType,
                Constants.BackoffPeriodInMilliseconds,
                Constants.MaxRetryAttempts,
                ex => ex is TimeoutException);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HBaseClient"/> class.
        /// </summary>
        /// <param name="credentials">The credentials.</param>
        /// <param name="retryPolicyFactory">The retry policy factory.</param>
        public HBaseClient(ClusterCredentials credentials, IRetryPolicyFactory retryPolicyFactory, ILoadBalancer loadBalancer = null)
        {
            retryPolicyFactory.ArgumentNotNull("retryPolicyFactory");

            if (credentials != null)
            {
                _requester = new WebRequesterSecure(credentials);
            }
            else
            {
                _requester    = new WebRequesterBasic();
                _loadBalancer = loadBalancer;
            }

            _retryPolicyFactory = retryPolicyFactory;
        }
示例#9
0
        public void SetUp()
        {
            _fixture = new Fixture();

            var containerBuilder = new ContainerBuilder();

            AugmentRegistrations(containerBuilder);
            var container = containerBuilder.Build();

            _retryPolicyFactory = container.Resolve <IRetryPolicyFactory>();

            _mockRetryBackoffCalculator.Setup(rbc => rbc.CalculateBackoff(It.IsAny <int>())).Returns(TimeSpan.Zero);

            _exceptionPredicates = new List <Func <Exception, bool> > {
                ex => ex.GetType() == typeof(TestException)
            };
        }
        public static async Task <IVersionedPropertyStore> CreateAsync(
            Guid activityId,
            TraceType traceType,
            Uri storeName,
            IPropertyManagerWrapper propertyManager,
            IRetryPolicyFactory retryPolicyFactory)
        {
            traceType.Validate("traceType");
            storeName.Validate("storeName");
            propertyManager.Validate("propertyManager");
            retryPolicyFactory.Validate("retryPolicyFactory");

            var store = new VersionedPropertyStore(traceType, storeName, propertyManager, retryPolicyFactory);

            await store.InitializeStoreNameAsync(activityId).ConfigureAwait(false);

            return(store);
        }
示例#11
0
        public WindowsServerRestartCoordinator(IConfigStore configStore, string configSectionName, Guid partitionId, long replicaId)
        {
            this.fabricClient           = new FabricClient();
            this.repairManagementClient = this.fabricClient.RepairManager;
            var healthPolicy = new WindowsServerRestartHealthCheckFactory(this.fabricClient).Create();

            this.retryPolicyFactory = new LinearRetryPolicyFactory(
                TraceType,
                WindowsServerRestartConstant.BackoffPeriodInMilliseconds,
                WindowsServerRestartConstant.MaxRetryAttempts,
                IsRetriableException);
            this.restartPolicy = new WindowsServerRestartPolicyFactory(
                healthPolicy,
                this,
                this.repairManagementClient,
                configStore,
                configSectionName).Create();

            this.pollingInterval = WindowsServerRestartConstant.CoordinatorPollingIntervalDefault;
        }
        public ClientPipelineBuilder(
            CosmosClient client,
            IRetryPolicyFactory retryPolicyFactory,
            ReadOnlyCollection <CosmosRequestHandler> customHandlers)
        {
            this.client           = client;
            this.transportHandler = new TransportHandler(client);
            Debug.Assert(this.transportHandler.InnerHandler == null, nameof(this.transportHandler));

            this.partitionKeyRangeGoneRetryHandler = new PartitionKeyRangeGoneRetryHandler(this.client);
            Debug.Assert(this.partitionKeyRangeGoneRetryHandler.InnerHandler == null, "The partitionKeyRangeGoneRetryHandler.InnerHandler must be null to allow other handlers to be linked.");

            this.invalidPartitionExceptionRetryHandler = new NamedCacheRetryHandler(this.client);
            Debug.Assert(this.invalidPartitionExceptionRetryHandler.InnerHandler == null, "The invalidPartitionExceptionRetryHandler.InnerHandler must be null to allow other handlers to be linked.");

            this.PartitionKeyRangeHandler = new PartitionKeyRangeHandler(client);
            Debug.Assert(this.PartitionKeyRangeHandler.InnerHandler == null, "The PartitionKeyRangeHandler.InnerHandler must be null to allow other handlers to be linked.");

            this.UseRetryPolicy(retryPolicyFactory);
            this.AddCustomHandlers(customHandlers);
        }
 protected StorageWithRetryPolicyFactory(IRetryPolicyFactory retryPolicyfactory)
 {
     this.retryPolicyFactory = retryPolicyFactory;
 }
 public EntitiesBlobContainer(StorageAccount account, IRetryPolicyFactory retryPolicyFactory)
     : this(account, retryPolicyFactory, typeof(T).Name.ToLowerInvariant())
 {
 }
示例#15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RetryPolicyCoordinator"/> class.
 /// </summary>
 /// <param name="retryPolicyFactory">A factory that is used to retrieve instances of <see cref="IRetryPolicy"/> that can be used to retry operations.</param>
 /// <param name="noOpFactory">A factory that is used to retrieve instances of <see cref="NoOpRetryPolicy"/> which can be used to prevent operations from being retried.</param>
 /// <param name="exceptionPredicates">The conditions indicating whether or not an operation that failed from a given exception should be retried.</param>
 public RetryPolicyCoordinator(IRetryPolicyFactory retryPolicyFactory, Func <NoOpRetryPolicy> noOpFactory, IEnumerable <IExceptionRetryPredicate> exceptionPredicates)
 {
     _retryPolicyFactory  = retryPolicyFactory;
     _noOpFactory         = noOpFactory;
     _exceptionPredicates = exceptionPredicates;
 }
 public EntitiesBlobContainer(StorageAccount account, IRetryPolicyFactory retryPolicyFactory, string blobContainerName) : base(retryPolicyFactory)
 {
     Trace.WriteLine(string.Format("Called constructor in EntitiesBlobContainer with account={0}, blobContainerName={1}", account.ConnectionString, blobContainerName), "UNITY");
     this.Account   = account;
     this.Container = blobContainerName;
 }
 static TenantCacheHelper()
 {
     RetryPolicyFactory = new ConfiguredRetryPolicyFactory();
     CacheFactory       = GetRetryPolicy().ExecuteAction <DataCacheFactory>(() => new DataCacheFactory());
 }
 protected StorageWithRetryPolicyFactory(IRetryPolicyFactory retryPolicyfactory)
 {
   this.retryPolicyFactory = retryPolicyFactory;
 }
示例#19
0
 public MessageQueue(StorageAccount account, IRetryPolicyFactory retryPolicyFactory, string queueName)
     : this(account, retryPolicyFactory, queueName, TimeSpan.FromSeconds(30))
 {
 }
示例#20
0
 public MessageQueue(StorageAccount account, IRetryPolicyFactory retryPolicyFactory)
     : this(account, retryPolicyFactory, typeof(T).Name.ToLowerInvariant())
 {
 }
示例#21
0
 public DataTable(StorageAccount account, IRetryPolicyFactory retryPolicyFactory)
     : this(account, retryPolicyFactory, typeof(T).Name)
 {
 }