/// <summary>
        /// Answers the common Supervisor for the given protocol or the defaultSupervisor if there is
        /// no registered common Supervisor. (INTERNAL ONLY)
        /// </summary>
        /// <typeparam name="T">The protocol of the supervisor.</typeparam>
        /// <param name="defaultSupervisor">The default Supervisor to be used if there is no registered common Supervisor.</param>
        /// <returns></returns>
        internal ISupervisor CommonSupervisorOr <T>(ISupervisor defaultSupervisor)
        {
            if (commonSupervisors.TryGetValue(typeof(T), out ISupervisor value))
            {
                return(value);
            }

            return(defaultSupervisor);
        }
 protected SupervisedWindowRenderer(ISupervisor supervisor,
                                    params UnityEngine.GUILayoutOption[]
                                    options) : base(options)
 {
     supervisor_ = supervisor;
     supervisor_.LockClearing     += ClearLock;
     supervisor_.WindowsDisposal  += DisposeWindow;
     supervisor_.WindowsRendering += RenderWindow;
 }
        public SupervisorProxy(ISupervisor supervisor)
        {
            if (supervisor == null)
                throw new ArgumentNullException("supervisor");

            Supervisor = supervisor;

            Init();
        }
 protected VesselSupervisedWindowRenderer(ISupervisor supervisor,
                                          PredictedVessel predicted_vessel,
                                          params UnityEngine.GUILayoutOption[]
                                          options) : base(
         supervisor,
         options)
 {
     predicted_vessel_ = predicted_vessel;
 }
Example #5
0
        public AuthenticateController(ILogger <AuthenticateController> logger, ISupervisor supervisor, IOptions <JwtAppSettings> config)
        {
            _logger = logger ??
                      throw new ArgumentNullException(nameof(logger));

            _supervisor = supervisor ??
                          throw new ArgumentNullException(nameof(supervisor));

            _config = config ??
                      throw new ArgumentNullException(nameof(config));
        }
Example #6
0
        public UsersController(ILogger <UsersController> logger, ISupervisor supervisor, IMapper mapper)
        {
            _logger = logger ??
                      throw new ArgumentNullException(nameof(logger));

            _supervisor = supervisor ??
                          throw new ArgumentNullException(nameof(supervisor));

            _mapper = mapper ??
                      throw new ArgumentNullException(nameof(mapper));
        }
Example #7
0
        public SupervisorProxy(ISupervisor supervisor)
        {
            if (supervisor == null)
            {
                throw new ArgumentNullException("supervisor");
            }

            Supervisor = supervisor;

            Init();
        }
Example #8
0
        //init
        public GeneratorSetup()
        {
            _reflectionInvoker = new ReflectionInvoker();
            EntityDescriptions = new Dictionary <Type, IEntityDescription>();
            TemporaryStorage   = new TemporaryStorage();

            DefaultSpreadStrategy     = new EvenSpreadStrategy();
            DefaultFlushStrategy      = new LimitedCapacityFlushStrategy(100);
            DefaultPersistentStorages = new List <IPersistentStorage>();
            Supervisor = new CompleteSupervisor();
        }
Example #9
0
 public PrivateController(IAccountRepository accountRepository, ICategoryRepository categoryRepository, IConfiguration configuration, IFileRepository fileRepository, IIntroductionRepository introductionRepository, IProjectRepository projectRepository, ISupervisor supervisor, ITokenManager tokenManager)
 {
     _accountRepository      = accountRepository;
     _categoryRepository     = categoryRepository;
     _configuration          = configuration;
     _fileRepository         = fileRepository;
     _introductionRepository = introductionRepository;
     _projectRepository      = projectRepository;
     _supervisor             = supervisor;
     _tokenManager           = tokenManager;
 }
Example #10
0
        public void HandleFailure(ISupervisor supervisor, PID child, RestartStatistics rs, Exception reason)
        {
            SetFailureCount(rs);
            var backoff  = rs.FailureCount * ToNanoseconds(_initialBackoff);
            var noise    = _random.Next(500);
            var duration = TimeSpan.FromMilliseconds(ToMilliseconds(backoff + noise));

            Task.Delay(duration).ContinueWith(t =>
            {
                supervisor.RestartChildren(reason, child);
            });
        }
Example #11
0
        async Task <ConnectionContext> CreateConnection(ISupervisor supervisor)
        {
            IConnection connection = null;

            try
            {
                if (supervisor.Stopping.IsCancellationRequested)
                {
                    throw new OperationCanceledException($"The connection is stopping and cannot be used: {_description}");
                }

                LogContext.Debug?.Log("Connecting: {Host}", _description);

                if (_configuration.Settings.ClusterMembers?.Any() ?? false)
                {
                    connection = _connectionFactory.Value.CreateConnection(_configuration.Settings.ClusterMembers, _configuration.Settings.ClientProvidedName);
                }
                else
                {
                    List <string> hostNames = Enumerable.Repeat(_configuration.Settings.Host, 1).ToList();

                    connection = _connectionFactory.Value.CreateConnection(hostNames, _configuration.Settings.ClientProvidedName);
                }

                LogContext.Debug?.Log("Connected: {Host} (address: {RemoteAddress}, local: {LocalAddress})", _description, connection.Endpoint,
                                      connection.LocalPort);

                var connectionContext = new RabbitMqConnectionContext(connection, _configuration, _hostTopology, _description, supervisor.Stopped);

                connectionContext.GetOrAddPayload(() => _configuration.Settings);

                return(connectionContext);
            }
            catch (ConnectFailureException ex)
            {
                connection?.Dispose();

                throw new RabbitMqConnectionException("Connect failed: " + _description, ex);
            }
            catch (BrokerUnreachableException ex)
            {
                connection?.Dispose();

                throw new RabbitMqConnectionException("Broker unreachable: " + _description, ex);
            }
            catch (OperationInterruptedException ex)
            {
                connection?.Dispose();

                throw new RabbitMqConnectionException("Operation interrupted: " + _description, ex);
            }
        }
        async Task <MessagingFactoryContext> CreateConnection(ISupervisor supervisor)
        {
            if (supervisor.Stopping.IsCancellationRequested)
            {
                throw new OperationCanceledException($"The connection is stopping and cannot be used: {_serviceUri}");
            }

            var messagingFactory = MessagingFactory.Create(_serviceUri, _messagingFactorySettings);

            messagingFactory.RetryPolicy = _retryPolicy;

            return(new ServiceBusMessagingFactoryContext(messagingFactory, supervisor.Stopped));
        }
Example #13
0
 /// <summary>
 /// Registers the <paramref name="supervisorClass"/> plugin by <paramref name="name"/> that will serve as the default supervise for all <c>Actor</c>
 /// that are not supervised by a specific supervisor.
 /// </summary>
 /// <param name="stageName">The <c>string</c> of the <c>Stage</c> in which the <paramref name="supervisorClass"/> is be registered.</param>
 /// <param name="name">The <c>string</c> name of the supervisor to register.</param>
 /// <param name="supervisorClass">The <c>Type</c> (which should be a subclass of <c>Actor</c>) to register as a supervisor.</param>
 public void RegisterDefaultSupervisor(string stageName, string name, Type supervisorClass)
 {
     try
     {
         var actualStageName = stageName.Equals("default") ? DefaultStage : stageName;
         var stage           = StageNamed(actualStageName);
         defaultSupervisor = stage.ActorFor <ISupervisor>(Definition.Has(supervisorClass, Definition.NoParameters, name));
     }
     catch (Exception e)
     {
         DefaultLogger.Error($"vlingo-net/actors: World cannot register default supervisor override: {supervisorClass.Name}", e);
     }
 }
Example #14
0
        public Project(uint id, string name, ISupervisor supervisor, ILogger logger, IEnumerable <IUser> users = null, IEnumerable <IIssue> issues = null)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("Project Name cannot be blank");
            }

            Id         = id;
            Name       = name;
            Supervisor = supervisor ?? throw new ArgumentNullException(nameof(supervisor));
            _users.AddRange(users ?? new IUser[0]);
            _issues.AddRange(issues ?? new IIssue[0]);
            _logger = logger;
        }
Example #15
0
        /// <summary>
        /// Adds a context to the supervisor as an agent, which can be stopped by the supervisor.
        /// </summary>
        /// <param name="supervisor">The supervisor</param>
        /// <typeparam name="T">The context type</typeparam>
        /// <returns>A context handle</returns>
        public static IAsyncPipeContextAgent <T> AddAsyncContext <T>(this ISupervisor supervisor)
            where T : class, PipeContext
        {
            if (supervisor == null)
            {
                throw new ArgumentNullException(nameof(supervisor));
            }

            IAsyncPipeContextAgent <T> contextAgent = new AsyncPipeContextAgent <T>();

            supervisor.Add(contextAgent);

            return(contextAgent);
        }
Example #16
0
            public IPipeContextAgent <SimpleContext> CreateContext(ISupervisor supervisor)
            {
                var context = new SimpleContextImpl()
                {
                    Value = Interlocked.Increment(ref _id).ToString()
                };

                IPipeContextAgent <SimpleContext> contextHandle = supervisor.AddContext <SimpleContext>(context);

                void SimpleContextOnInvalid(object sender, EventArgs args) => contextHandle.DisposeAsync();

                context.OnInvalid += SimpleContextOnInvalid;

                return(contextHandle);
            }
Example #17
0
        public Supervisor_Tests()
        {
            _tokenMock.Setup(x => x.ValidateToken("valid")).Returns(new MockPrincipal(new ClaimsIdentity
                                                                                      (
                                                                                          new List <Claim>
            {
                new Claim(ClaimTypes.Role, "valid")
            }
                                                                                      )));
            _tokenMock.Setup(x => x.ValidateToken("invalid")).Returns(new MockPrincipal(new ClaimsIdentity()));
            _tokenMock.Setup(x => x.ValidateToken("SecurityTokenException")).Returns(() => throw new SecurityTokenException());
            _tokenMock.Setup(x => x.ValidateToken("IPrincipal-null")).Returns <IPrincipal>(null);

            _supervisor = new Supervisor(_logger.Object);
        }
        public void HandleFailure(
            ISupervisor supervisor,
            PID child,
            RestartStatistics rs,
            Exception reason,
            object?message
            )
        {
            var directive = _decider(child, reason);

            switch (directive)
            {
            case SupervisorDirective.Resume:
                LogInfo("Resuming");
                supervisor.ResumeChildren(child);
                break;

            case SupervisorDirective.Restart:
                if (ShouldStop(rs))
                {
                    LogInfo("Stopping");
                    supervisor.StopChildren(supervisor.Children.ToArray());
                }
                else
                {
                    LogInfo("Restarting");
                    supervisor.RestartChildren(reason, supervisor.Children.ToArray());
                }

                break;

            case SupervisorDirective.Stop:
                LogInfo("Stopping");
                supervisor.StopChildren(supervisor.Children.ToArray());
                break;

            case SupervisorDirective.Escalate:
                supervisor.EscalateFailure(reason, message);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            void LogInfo(string action) => Logger.LogInformation("{Action} {Actor} because of {Reason}", action,
                                                                 child, reason
                                                                 );
        }
        async Task <ConnectionContext> CreateConnection(ISupervisor supervisor)
        {
            if (supervisor.Stopping.IsCancellationRequested)
            {
                throw new OperationCanceledException($"The connection is stopping and cannot be used: {_endpoint}");
            }

            var connection = new ServiceBusConnection(_endpoint.ToString(), _settings.TransportType, _retryPolicy)
            {
                TokenProvider    = _settings.TokenProvider,
                OperationTimeout = _settings.OperationTimeout,
            };

            var managementClient = new ManagementClient(_endpoint.ToString(), _settings.TokenProvider);

            return(new ServiceBusConnectionContext(connection, managementClient, _retryPolicy, _settings.OperationTimeout, supervisor.Stopped));
        }
Example #20
0
        public void HandleFailure(ISupervisor supervisor, PID child, RestartStatistics rs, Exception reason, object message)
        {
            if (rs.NumberOfFailures(_backoffWindow) == 0)
            {
                rs.Reset();
            }

            rs.Fail();

            var backoff  = rs.FailureCount * ToNanoseconds(_initialBackoff);
            var noise    = _random.Next(500);
            var duration = TimeSpan.FromMilliseconds(ToMilliseconds(backoff + noise));

            Task.Delay(duration).ContinueWith(t =>
            {
                supervisor.RestartChildren(reason, child);
            });
        }
Example #21
0
        /// <summary>
        /// Adds a context to the supervisor as an agent, which can be stopped by the supervisor.
        /// </summary>
        /// <param name="supervisor">The supervisor</param>
        /// <param name="context">The context</param>
        /// <typeparam name="T">The context type</typeparam>
        /// <returns>A context handle</returns>
        public static IPipeContextAgent <T> AddContext <T>(this ISupervisor supervisor, Task <T> context)
            where T : class, PipeContext
        {
            if (supervisor == null)
            {
                throw new ArgumentNullException(nameof(supervisor));
            }
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            IPipeContextAgent <T> contextAgent = new PipeContextAgent <T>(context);

            supervisor.Add(contextAgent);

            return(contextAgent);
        }
        async Task <ConnectionContext> CreateConnection(ISupervisor supervisor)
        {
            var description = _configuration.Settings.ToDescription();

            return(await _configuration.ReceiveTransportRetryPolicy.Retry(async() =>
            {
                if (supervisor.Stopping.IsCancellationRequested)
                {
                    throw new OperationCanceledException($"The connection is stopping and cannot be used: {description}");
                }

                IConnection connection = null;
                try
                {
                    TransportLogMessages.ConnectHost(description);

                    connection = _configuration.Settings.CreateConnection();

                    connection.Start();

                    LogContext.Debug?.Log("Connected: {Host} (client-id: {ClientId}, version: {Version})", description,
                                          connection.ClientId, connection.MetaData.NMSVersion);

                    return new ActiveMqConnectionContext(connection, _configuration, supervisor.Stopped);
                }
                catch (OperationCanceledException)
                {
                    connection?.Dispose();
                    throw;
                }
                catch (NMSConnectionException ex)
                {
                    connection?.Dispose();
                    throw new ActiveMqConnectionException("Connection exception: " + description, ex);
                }
                catch (Exception ex)
                {
                    connection?.Dispose();
                    throw new ActiveMqConnectionException("Create Connection Faulted: " + description, ex);
                }
            }, supervisor.Stopping).ConfigureAwait(false));
        }
        async Task <ConnectionContext> CreateConnection(ISupervisor supervisor)
        {
            var description = _hostConfiguration.Settings.ToDescription();

            if (supervisor.Stopping.IsCancellationRequested)
            {
                throw new OperationCanceledException($"The connection is stopping and cannot be used: {description}");
            }

            IConnection connection = null;

            try
            {
                TransportLogMessages.ConnectHost(description);

                connection = _hostConfiguration.Settings.CreateConnection();

                connection.Start();

                LogContext.Debug?.Log("Connected: {Host} (client-id: {ClientId}, version: {Version})", description,
                                      connection.ClientId, connection.MetaData.NMSVersion);

                return(new ActiveMqConnectionContext(connection, _hostConfiguration, supervisor.Stopped));
            }
            catch (OperationCanceledException)
            {
                connection?.Dispose();
                throw;
            }
            catch (NMSConnectionException ex)
            {
                connection?.Dispose();
                LogContext.Warning?.Log(ex, "Connection Failed: {InputAddress}", _hostConfiguration.HostAddress);
                throw new ActiveMqConnectionException("Connection exception: " + description, ex);
            }
            catch (Exception ex)
            {
                connection?.Dispose();
                LogContext.Warning?.Log(ex, "Connection Failed: {InputAddress}", _hostConfiguration.HostAddress);
                throw new ActiveMqConnectionException("Create Connection Faulted: " + description, ex);
            }
        }
        async Task <ConnectionContext> CreateConnection(ISupervisor supervisor)
        {
            IConnection connection = null;

            try
            {
                if (supervisor.Stopping.IsCancellationRequested)
                {
                    throw new OperationCanceledException($"The connection is stopping and cannot be used: {_description}");
                }

                if (_log.IsDebugEnabled)
                {
                    _log.DebugFormat("Connecting: {0}", _description);
                }

                connection = _settings.CreateConnection();

                connection.Start();

                if (_log.IsDebugEnabled)
                {
                    _log.DebugFormat("Connected: {0} (client-id: {1}, version: {2})", _description, connection.ClientId, connection.MetaData.NMSVersion);
                }

                var connectionContext = new ActiveMqConnectionContext(connection, _settings, _topology, _description, supervisor.Stopped);
                connectionContext.GetOrAddPayload(() => _settings);

                return(connectionContext);
            }
            catch (NMSConnectionException ex)
            {
                if (_log.IsDebugEnabled)
                {
                    _log.Debug("ActiveMQ Connect failed:", ex);
                }

                connection?.Dispose();

                throw new ActiveMqConnectException("Connect failed: " + _description, ex);
            }
        }
Example #25
0
        /// <summary>
        /// Adds a context to the supervisor as an agent, which can be stopped by the supervisor.
        /// </summary>
        /// <param name="supervisor">The supervisor</param>
        /// <param name="contextHandle">The actual context handle</param>
        /// <param name="context">The active context</param>
        /// <typeparam name="T">The context type</typeparam>
        /// <returns>A context handle</returns>
        public static IActivePipeContextAgent <T> AddActiveContext <T>(this ISupervisor supervisor, PipeContextHandle <T> contextHandle, T context)
            where T : class, PipeContext
        {
            if (supervisor == null)
            {
                throw new ArgumentNullException(nameof(supervisor));
            }
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var activeContext = new ActivePipeContext <T>(contextHandle, context);

            var contextAgent = new ActivePipeContextAgent <T>(activeContext);

            supervisor.Add(contextAgent);

            return(contextAgent);
        }
Example #26
0
        private Actor CreateRawActor(
            Definition definition,
            Actor parent,
            Address maybeAddress,
            IMailbox maybeMailbox,
            ISupervisor maybeSupervisor,
            ILogger logger)
        {
            if (IsStopped)
            {
                throw new InvalidOperationException("Actor stage has been stopped.");
            }

            var address = maybeAddress ?? World.AddressFactory.UniqueWith(definition.ActorName);

            if (directory.IsRegistered(address))
            {
                throw new InvalidOperationException("Address already exists: " + address);
            }

            var mailbox = maybeMailbox ?? ActorFactory.ActorMailbox(this, address, definition);

            Actor actor;

            try
            {
                actor = ActorFactory.ActorFor(this, parent, definition, address, mailbox, maybeSupervisor, logger);
            }
            catch (Exception e)
            {
                logger.Log($"Actor instantiation failed because: {e.Message}");
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
                throw new InvalidOperationException($"Actor instantiation failed because: {e.Message}", e);
            }

            directory.Register(actor.Address, actor);
            actor.LifeCycle.BeforeStart(actor);

            return(actor);
        }
Example #27
0
        public void Work(ISupervisor supervisor, Message message)
        {
            Supervisor = supervisor;

            var result = DoWorkInternal(message);

            switch (result)
            {
            case Result.Failure:
                OnFailure();
                break;

            case Result.Error:
                OnError(_lastException);
                break;

            default:
                OnSuccess();
                break;
            }
        }
Example #28
0
 internal ActorProtocolActor <object>[] ActorProtocolFor(
     Definition definition,
     Type[] protocols,
     Actor parent,
     Address maybeAddress,
     IMailbox maybeMailbox,
     ISupervisor maybeSupervisor,
     ILogger logger)
 {
     try
     {
         var actor          = CreateRawActor(definition, parent, maybeAddress, maybeMailbox, maybeSupervisor, logger);
         var protocolActors = ActorProxyFor(protocols, actor, actor.LifeCycle.Environment.Mailbox);
         return(ActorProtocolActor <object> .AllOf(actor, protocolActors));
     }
     catch (Exception e)
     {
         World.DefaultLogger.Log($"vlingo/actors: FAILED: {e.Message}", e);
         return(null);
     }
 }
Example #29
0
            public ReferenceFrameSelector(ISupervisor supervisor,
                                          Callback on_change,
                                          string name)
                : base(supervisor, UnityEngine.GUILayout.MinWidth(0))
            {
                on_change_ = on_change;
                name_      = name;

                // TODO(phl): Bogus initialization.  Find a way to get these data from the
                // C++ side (we do for flight planning).
                frame_type         = FrameType.BODY_CENTRED_NON_ROTATING;
                selected_celestial = FlightGlobals.GetHomeBody();

                expanded_ = new Dictionary <CelestialBody, bool>();
                foreach (CelestialBody celestial in FlightGlobals.Bodies)
                {
                    if (!celestial.is_leaf() && !celestial.is_root())
                    {
                        expanded_.Add(celestial, false);
                    }
                }
            }
        public static async Task <TAgent> CreateAgent <T, TAgent>(this ISupervisor <T> supervisor, IAsyncPipeContextAgent <TAgent> asyncContext,
                                                                  Func <T, CancellationToken, Task <TAgent> > agentFactory, CancellationToken cancellationToken)
            where T : class, PipeContext
            where TAgent : class, PipeContext
        {
            var createAgentPipe = new CreateAgentPipe <T, TAgent>(asyncContext, agentFactory, cancellationToken);

            var supervisorTask = supervisor.Send(createAgentPipe, cancellationToken);

            await Task.WhenAny(supervisorTask, asyncContext.Context).ConfigureAwait(false);

            if (supervisorTask.IsFaulted)
            {
                await asyncContext.CreateFaulted(supervisorTask.Exception).ConfigureAwait(false);
            }
            else if (supervisorTask.IsCanceled)
            {
                await asyncContext.CreateCanceled().ConfigureAwait(false);
            }

            return(await asyncContext.Context.ConfigureAwait(false));
        }
Example #31
0
        //public bool RequestRestartPermission(int maxNrOfRetries, TimeSpan? withinTimeSpan)
        //{
        //    if (maxNrOfRetries == 0)
        //    {
        //        return false;
        //    }

        //    FailureCount++;

        //    //supervisor says child may restart, and we don't care about any timewindow
        //    if (withinTimeSpan == null)
        //    {
        //        return FailureCount <= maxNrOfRetries;
        //    }

        //    var max = DateTime.Now - withinTimeSpan;
        //    if (LastFailureTime > max)
        //    {
        //        return FailureCount <= maxNrOfRetries;
        //    }

        //    //we are past the time limit, we can safely reset the failure count and restart
        //    FailureCount = 0;
        //    return true;
        //}

        public void HandleFailure(ISupervisor supervisor, PID child, RestartStatistics crs, Exception reason)
        {
            var directive = _decider(child, reason);

            switch (directive)
            {
            case SupervisorDirective.Resume:
                //resume the failing child
                child.SendSystemMessage(ResumeMailbox.Instance);
                break;

            case SupervisorDirective.Restart:
                //restart the failing child
                if (crs.RequestRestartPermission(_maxNrOfRetries, _withinTimeSpan))
                {
                    Console.WriteLine($"Restarting {child.ToShortString()} Reason {reason}");
                    child.SendSystemMessage(Restart.Instance);
                }
                else
                {
                    Console.WriteLine($"Stopping {child.ToShortString()} Reason { reason}");
                    child.Stop();
                }
                break;

            case SupervisorDirective.Stop:
                //stop the failing child
                Console.WriteLine($"Stopping {child.ToShortString()} Reason {reason}");
                child.Stop();
                break;

            case SupervisorDirective.Escalate:
                supervisor.EscalateFailure(child, reason);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
 public Director(ISupervisor supervisor)
 {
     this.Supervisor = supervisor;
 }
        internal void InitialiseAdapter()
        {
            _logger.Info("Requesting Adapter Start");

            if (PlatformConnector == null)
            {
                _logger.Fatal("Plugin could not be found. Ensure that plugin is copied in folder and restart the service");
                return;
            }

            List<INinjectModule> modules = new List<INinjectModule> { new BootStrapper() };

            if (PluginBootstrapper != null)
            {
                _logger.InfoFormat("Plugin Bootstrapper found of type={0}", PluginBootstrapper.GetType().Name);
                modules.AddRange(PluginBootstrapper.BootstrapModules);
            }

            StandardKernel iocContainer = new StandardKernel(modules.ToArray());


            var settings = iocContainer.Get<ISettings>();
            var service = iocContainer.Get<IServiceFacade>();
            var streamListenerManager = iocContainer.Get<IStreamListenerManager>();
            
            iocContainer.Settings.InjectNonPublic = true;
            
            //needed for Plugin properties since plugin is not instantiated by Ninject
            iocContainer.Inject(PlatformConnector);

            _adapter = new Adapter(settings, service, PlatformConnector, streamListenerManager);

            if (settings.UseSupervisor)
            {
                // SS.Integration.Diagnostics.RestService uses Owin.HttpListeners.
                // that assembly must be referenced in the startup project even if not
                // directly used, so do not remove it from the list of references
                _supervisor = iocContainer.Get<ISupervisor>();
                if (_supervisor == null)
                {
                    _logger.Error("Cannot instantiate Supervisor as not suitable module was found");
                }
                else
                {
                    _logger.Info("Initializing adapter's supervisor");
                    try
                    {
                        _supervisor.Initialise();
                    }
                    catch (Exception e)
                    {
                        _logger.Error("An error occured during the initialization of the adapter's supervisor. The supervisor will not be available", e);
                    }
                }
            }


            _adapter.Start();

            _logger.Info("Adapter has started");
        }
 public TechnicalManager(ISupervisor supervisor)
 {
     this.Supervisor = supervisor;
 }