コード例 #1
0
        public virtual void Execute(IJobExecutionContext context)
        {
            using (ILoggingOperation log = _logger.NormalOperation().AddProperty("jobId", context.JobDetail.Key.Name))
            {
                try
                {
                    RemoteCall(context);
                    ProbeManager.Ask().AppCounter($"{GetType().Name}.completed").Increment();
                    _logger.Info($"job={context.JobDetail.Key.Name} executed");
                }
                catch (Exception e)
                {
                    if (context.RefireCount < Convert.ToInt32(RetryCount))
                    {
                        ProbeManager.Ask().AppCounter($"{GetType().Name}.error-refire").Increment();
                        _logger.Warn($"job={context.JobDetail.Key.Name}, refireCount={context.RefireCount}");
                        throw new JobExecutionException(e, true);
                    }
                    else
                    {
                        ProbeManager.Ask().AppCounter($"{GetType().Name}.error-definitive").Increment();
                        _logger.Error($"job={context.JobDetail.Key.Name}, refireCount={context.RefireCount}, params={JsonConvert.SerializeObject(context.MergedJobDataMap)}");

                        context.Scheduler.RescheduleJob(context.Trigger.Key, (ITrigger)context.Trigger.Clone());

                        context.Scheduler.PauseJob(context.JobDetail.Key);
                    }
                }
            }
        }
コード例 #2
0
    void Start()
    {
        probeManagement = GetComponent <ProbeManager>();
        Load();
        HandleDisplay();

        mainCircle         = new Circle(0, 0, 2);
        endCircle          = new Circle(0, 0, 7);
        distanceDifference = Vector2.Distance(endCircle.Vector2FromAngle(0), endCircle.Vector2FromAngle(angleDifference));
        angleArray         = new AngleCircleArray(new CircleDrawer(LinePrefab, endCircle, angleDifference, 1f, NormalMaterial));

        levelScore = new LevelDegrees(4, 6, maxProbeNumber);


        CreateRocket();
    }
コード例 #3
0
        protected void Application_Start(object sender, EventArgs e)
        {
            _logger = LogManager.GetLogger(GetType());

            using (ILoggingOperation log = _logger.CriticalOperation())
            {
                log.Wrap(() =>
                {
                    ProbeManager.Init();
                    HealthCheckManager.Init();
                    ReportingManager.Init();
                    RemoteReportingManager.Init();
                });

                log.Wrap(() => ChannelsRabbitMQManager.Init());

                log.Wrap(() => Factory   = new StdSchedulerFactory());
                log.Wrap(() => Scheduler = Factory.GetScheduler());

                log.Wrap(() => Scheduler.Start());
            }
        }
コード例 #4
0
ファイル: ProbeManagerTest.cs プロジェクト: yonglehou/modSIC
        public void MyTestInitialize()
        {
            var           mocks                     = new MockRepository();
            Func <IProbe> registryMethod            = delegate() { return(new RegistryProber()); };
            Func <IProbe> familyProberWindowsMethod = delegate { return(new FamilyProberWindows()); };
            Func <IProbe> familyProberUnixMethod    = delegate { return(new FamilyProberUnix()); };
            Func <IProbe> lineProberCiscoIosMethod  = delegate { return(new LineProber()); };
            Func <ISystemInformationService> systemInformationMethod = delegate() { return(new WindowsSystemInformationService()); };

            var registryProbe =
                mocks.StrictMock <Lazy <IProbe, IProbeCapabilities> >(
                    registryMethod, GetProbeCapability("registry", FamilyEnumeration.windows));
            var familyProberWindows =
                mocks.StrictMock <Lazy <IProbe, IProbeCapabilities> >(
                    familyProberWindowsMethod, GetProbeCapability("family", FamilyEnumeration.windows));
            var familyProberUnix =
                mocks.StrictMock <Lazy <IProbe, IProbeCapabilities> >(
                    familyProberUnixMethod, GetProbeCapability("family", FamilyEnumeration.unix));
            var lineProberCiscoIOS =
                mocks.StrictMock <Lazy <IProbe, IProbeCapabilities> >(
                    lineProberCiscoIosMethod, GetProbeCapability("line", FamilyEnumeration.ios));

            var probes = GetProbeCapabilities(registryProbe, familyProberWindows, familyProberUnix, lineProberCiscoIOS);

            var windowsInformationService =
                mocks.StrictMock <Lazy <ISystemInformationService, ISystemInformationServicePlataform> >(
                    systemInformationMethod, GetSystemInformationSvcForWindows());

            var systemInformations =
                new Lazy <ISystemInformationService, ISystemInformationServicePlataform>[] { windowsInformationService };

            ProbeManager = new ProbeManager()
            {
                probes = probes, systemInformationServices = systemInformations
            };
        }
コード例 #5
0
 public RemoteCallJobBase()
 {
     _logger = LogManager.GetLogger(GetType());
     ProbeManager.Ask().AppCounter($"{GetType().Name}.created").Increment();
 }