Пример #1
0
        public ReliableFaultsEngine(ActionStore actionStore, bool isTestMode, IStatefulServicePartition partition, int commandStepRetryBackoffInSeconds)
        {
            ThrowIf.Null(actionStore, "actionStore");

            this.random = new Random();

            this.actionStore = actionStore;
            this.isTestMode  = isTestMode;

            this.partition = partition;

            this.commandStepRetryBackoffInSeconds = commandStepRetryBackoffInSeconds;
        }
        // In the end, I'd like the first arg to be a fabricClient producer as opposed to a raw client
        public FaultAnalysisServiceMessageProcessor(
            IStatefulServicePartition partition,
            FabricClient fabricClient,
            ReliableFaultsEngine engine,
            ActionStore actionStore,
            IReliableStateManager stateManager,
            IReliableDictionary <string, bool> stoppedNodeTable,
            TimeSpan requestTimeout,
            TimeSpan operationTimeout,
            int concurrentRequests,
            int dataLossCheckWaitDurationInSeconds,
            int dataLossCheckPollIntervalInSeconds,
            int replicaDropWaitDurationInSeconds,
            CancellationToken cancellationToken)
        {
            ThrowIf.Null(partition, "partition");
            ThrowIf.Null(fabricClient, "fabricClient");
            ThrowIf.Null(engine, "engine");
            ThrowIf.Null(actionStore, "actionStore");
            ThrowIf.Null(stateManager, "stateManager");
            ThrowIf.Null(stoppedNodeTable, "stoppedNodeTable");

            this.Partition        = partition;
            this.fabricClient     = fabricClient;
            this.engine           = engine;
            this.actionStore      = actionStore;
            this.stoppedNodeTable = stoppedNodeTable;
            this.stateManager     = stateManager;

            this.requestTimeout   = requestTimeout;
            this.operationTimeout = operationTimeout;

            this.entitySynch = new EntitySynchronizer();

            this.queue        = new BlockingCollection <ActionStateBase>(new ConcurrentQueue <ActionStateBase>());
            this.pendingTasks = new ConcurrentDictionary <Guid, ActionCompletionInfo>();

            this.concurrentRequests = concurrentRequests;
            this.dataLossCheckWaitDurationInSeconds = dataLossCheckWaitDurationInSeconds;
            this.dataLossCheckPollIntervalInSeconds = dataLossCheckPollIntervalInSeconds;
            this.replicaDropWaitDurationInSeconds   = replicaDropWaitDurationInSeconds;

            this.consumerTask     = Task.Run(() => this.ConsumeAndRunActionsAsync(cancellationToken), cancellationToken);
            this.pendingTasksTask = Task.Run(() => this.ProcessCompletedActionsAsync(cancellationToken), cancellationToken);
        }