Exemplo n.º 1
0
        public void StopPlugin()
        {
            Log.Info("StopPlugin");

            Status = StatusEnum.Stopping;

            _cancellationTokenSource.Cancel();

            if (_taskManager != null)
            {
                _taskManager.ShutDown();
                _taskManager = null;
            }

            if (_queuesManager != null)
            {
                _queuesManager.ShutDown();
                _queuesManager = null;
            }

            if (_octaneApis != null)
            {
                _octaneApis.ShutDown();
                _octaneApis = null;
            }

            _octaneInitializationThread = null;
            Status = StatusEnum.Stopped;

            Log.Info("StopPlugin Done");
        }
Exemplo n.º 2
0
        private void StartPluginInternal(CancellationToken token)
        {
            Status = StatusEnum.Connecting;
            while (Status != StatusEnum.Connected && !token.IsCancellationRequested)
            {
                try
                {
                    TfsApis    tfsApis    = ConnectionCreator.CreateTfsConnection(_connectionDetails);
                    OctaneApis octaneApis = ConnectionCreator.CreateOctaneConnection(_connectionDetails);

                    _taskManager = new OctaneTaskManager(tfsApis, octaneApis);
                    _taskManager.Start();
                    _queuesManager = new QueuesManager(tfsApis, octaneApis);
                    _queuesManager.Start();

                    _initFailCounter = 0;
                    Status           = StatusEnum.Connected;
                }
                catch (Exception ex)
                {
                    Log.Error($"Error in StartPlugin : {ex.Message}", ex);
                    if (_queuesManager != null)
                    {
                        _queuesManager.ShutDown();
                        _queuesManager = null;
                    }
                    if (_taskManager != null)
                    {
                        _taskManager.ShutDown();
                        _taskManager = null;
                    }
                }

                //Sleep till next retry
                if (Status != StatusEnum.Connected)
                {
                    int initTimeoutIndex   = Math.Min((_initFailCounter / 3), _initTimeoutInMinutesArr.Length - 1);
                    int initTimeoutMinutes = _initTimeoutInMinutesArr[initTimeoutIndex];
                    Log.Info($"Wait {initTimeoutMinutes} minute(s) till next initialization attempt...");
                    Thread.Sleep(initTimeoutMinutes * 1000 * 60);
                    _initFailCounter++;
                }
            }
        }
Exemplo n.º 3
0
 public QueuesManager(TfsApis tfsApis, OctaneApis octaneApis)
 {
     _octaneApis = octaneApis;
     _tfsApis    = tfsApis;
 }
 public OctaneTaskManager(TfsApis tfsApis, OctaneApis octaneApis, int pollingTimeout = DEFAULT_POLLING_GET_TIMEOUT)
 {
     _tfsApis           = tfsApis;
     _octaneApis        = octaneApis;
     _pollingGetTimeout = pollingTimeout;
 }
 public OctaneTaskManager(TfsApis tfsApis, OctaneApis octaneApis)
 {
     _tfsApis    = tfsApis;
     _octaneApis = octaneApis;
 }