public void Start()
 {
     _maintenanceTask = PoolOfThreads.GlobalRavenThreadPool.LongRunning(_ =>
     {
         try
         {
             ListenToMaintenanceWorker();
         }
         catch (ObjectDisposedException)
         {
             // expected
         }
         catch (OperationCanceledException)
         {
             // expected
         }
         catch (Exception e)
         {
             if (_log.IsInfoEnabled)
             {
                 _log.Info($"Exception occurred while collecting info from {ClusterTag}. Task is closed.", e);
             }
             // we don't want to crash the process so we don't propagate this exception.
         }
     }, null, _name);
 }
 public void Start()
 {
     _collectingTask = PoolOfThreads.GlobalRavenThreadPool.LongRunning(_ =>
     {
         try
         {
             CollectDatabasesStatusReport();
         }
         catch (ObjectDisposedException)
         {
             // expected
         }
         catch (OperationCanceledException)
         {
             // expected
         }
         catch (Exception e)
         {
             if (_logger.IsInfoEnabled)
             {
                 _logger.Info($"Exception occurred while collecting info from {_server.NodeTag}. Task is closed.", e);
             }
             // we don't want to crash the process so we don't propagate this exception.
         }
     }
                                                                       , null, _name);
 }
Beispiel #3
0
        public void AcceptConnection(LogLengthNegotiation negotiation)
        {
            // if leader / candidate, this remove them from play and revert to follower mode
            _engine.SetNewState(RachisState.Follower, this, _term,
                                $"Accepted a new connection from {_connection.Source} in term {negotiation.Term}");
            _engine.LeaderTag = _connection.Source;
            _engine.Timeout.Start(_engine.SwitchToCandidateStateOnTimeout);

            _debugRecorder.Record("Follower connection accepted");

            _folloowerLongRunningWork =
                PoolOfThreads.GlobalRavenThreadPool.LongRunning(
                    action: x => Run(x),
                    state: negotiation,
                    name: $"Follower thread from {_connection} in term {negotiation.Term}");
        }
Beispiel #4
0
        public void Start(Dictionary <string, RemoteConnection> connections = null)
        {
            _running.Raise();

            ClusterTopology clusterTopology;

            using (_engine.ContextPool.AllocateOperationContext(out TransactionOperationContext context))
                using (context.OpenReadTransaction())
                {
                    clusterTopology = _engine.GetTopology(context);
                }

            RefreshAmbassadors(clusterTopology, connections);

            _leaderLongRunningWork =
                PoolOfThreads.GlobalRavenThreadPool.LongRunning(x => Run(), null, $"Consensus Leader - {_engine.Tag} in term {Term}");
        }
Beispiel #5
0
 public void Run()
 {
     _electorLongRunningWork = PoolOfThreads.GlobalRavenThreadPool.LongRunning(x => HandleVoteRequest(), null, $"Elector for candidate {_connection.Source}");
 }
Beispiel #6
0
 public void Start()
 {
     _longRunningSendingWork =
         PoolOfThreads.GlobalRavenThreadPool.LongRunning(x => ReplicateToDestination(), null, OutgoingReplicationThreadName);
 }
Beispiel #7
0
 public void Start()
 {
     _longRunningWork = PoolOfThreads.GlobalRavenThreadPool.LongRunning(x => Run(), null, "Candidate for - " + _engine.Tag);
 }
 public void Start()
 {
     _txLongRunningOperation = PoolOfThreads.GlobalRavenThreadPool.LongRunning(x => MergeOperationThreadProc(), null, TransactionMergerThreadName);
 }