예제 #1
0
        public override void OnAfterBootStrapComplete(IFoundation foundation)
        {
            base.OnAfterBootStrapComplete(foundation);

            // Replace Exception Handlers
            foundation.Container.RegisterType <IHandleException, HealthFriendlyExceptionHandler>(new ContainerControlledLifetimeManager());
            foundation.Container.RegisterType <IHandleExceptionProvider, HealthFriendlyExceptionHandlerProvider>(new ContainerControlledLifetimeManager());
            foundation.Container.RegisterInstance <HealthFriendlyExceptionHandlerProvider>(new HealthFriendlyExceptionHandlerProvider(foundation, foundation.GetLogger()), new ContainerControlledLifetimeManager());

            foundation.Container.RegisterType <IHandleException, HealthSwallowExceptionHandler>(Assumptions.SWALLOWED_EXCEPTION_HANDLER, new ContainerControlledLifetimeManager());
            foundation.Container.RegisterType <IHandleExceptionProvider, HealthSwallowExceptionHandlerProvider>(Assumptions.SWALLOWED_EXCEPTION_HANDLER, new ContainerControlledLifetimeManager());
            foundation.Container.RegisterInstance <HealthSwallowExceptionHandlerProvider>(Assumptions.SWALLOWED_EXCEPTION_HANDLER, new HealthSwallowExceptionHandlerProvider(foundation, foundation.GetLogger()), new ContainerControlledLifetimeManager());

            foundation.Container.RegisterInstance <ServerHealthExtractor>(new ServerHealthExtractor(foundation), new ContainerControlledLifetimeManager());

            DaemonConfig healthConfig = new DaemonConfig()
            {
                InstanceName           = HealthReportDaemon.DAEMON_NAME,
                ContinueOnError        = true,
                IntervalMilliSeconds   = 15 * 1000, // every 15 seconds
                StartDelayMilliSeconds = 60 * 1000,
                TaskConfiguration      = string.Empty
            };

            foundation.GetDaemonManager().RegisterDaemon(healthConfig, new HealthReportDaemon(foundation), true);
        }
예제 #2
0
 protected virtual void RegisterErrorHandlers(IFoundation foundation)
 {
     // Replace Exception Handlers
     foundation.Container.RegisterType <IHandleException, FriendlyExceptionHandler>(new ContainerControlledLifetimeManager());
     foundation.Container.RegisterType <IHandleExceptionProvider, FriendlyExceptionHandlerProvider>(new ContainerControlledLifetimeManager());
     foundation.Container.RegisterInstance <FriendlyExceptionHandlerProvider>(new FriendlyExceptionHandlerProvider(foundation, foundation.GetLogger()), new ContainerControlledLifetimeManager());
 }