Exemple #1
0
 protected override void InternalRun(string[] args)
 {
     if (args.Contains("/service-run", StringComparer.OrdinalIgnoreCase))
     {
         Directory.SetCurrentDirectory(AppContext.BaseDirectory);
         Core.Log.LibDebug("Starting...");
         Core.Log.InfoBasic("Current Directory: {0}", Directory.GetCurrentDirectory());
         InitAction?.Invoke();
         if (!string.IsNullOrWhiteSpace(BannerText))
         {
             var bannerText = BannerText.Split("\r\n");
             foreach (var line in bannerText)
             {
                 Core.Log.InfoBasic(line);
             }
         }
         Core.Log.InfoBasic("*** RUNNING AS WINDOWS SERVICE ***");
         ShowFullHeader();
         try
         {
             var win32Service = new Win32Service(ServiceName, Service);
             var serviceHost  = new Win32ServiceHost(win32Service);
             serviceHost.Run();
         }
         catch (Exception ex)
         {
             Core.Log.Write(ex);
         }
     }
     else
     {
         base.InternalRun(args);
     }
 }
Exemple #2
0
 protected override void InvokeInitActionOnce()
 {
     if (!WasInitActionInvoked)
     {
         CacheManager.Init();
         InitAction?.Invoke(CacheManager);
         WasInitActionInvoked = true;
     }
 }
        /// <summary>
        /// 默认15分钟
        /// </summary>
        /// <param name="clearSpan"></param>
        public static void StartClear(TimeSpan?clearSpan = null)
        {
            if (clearSpan != null)
            {
                _clearSpan = clearSpan.Value;
            }

            _doStart.Invoke();
        }
 private TOutput InvokeRowTransformationFunc(TInput row)
 {
     if (!WasInitialized)
     {
         InitAction?.Invoke();
         WasInitialized = true;
         NLogger.Debug(TaskName + " was initialized!", TaskType, "LOG", TaskHash, ControlFlow.ControlFlow.STAGE, ControlFlow.ControlFlow.CurrentLoadProcess?.LoadProcessKey);
     }
     return(RowTransformationFunc.Invoke(row));
 }
        public ISqlConfigExecutor GetExecutor(DbContext db, string tableName, [CallerMemberName] string sqlName = null)
        {
            //在获取Executor之前,进行初始化策略执行,只初始化一次(如果配置有新的修改,那么就会重新进行初始化)
            _init.Invoke(-1);

            var tableInfo = _config.TableSqlInfos[tableName];
            var sqlInfo   = tableInfo.Sqls[sqlName];
            var newlySql  = _dictNewlySqls[tableName][sqlName];

            return(_sqlConfigExecutorCreator.Create(this, db, tableName, sqlName, sqlInfo, tableInfo, newlySql));
        }
        public ILuaSqlConfigExecutor GetExecutor(DbContext db, string tableName,
                                                 [CallerMemberName] string sqlName = null)
        {
            //在获取Executor之前,进行初始化策略执行,只初始化一次(如果配置有新的修改,那么就会重新进行初始化)
            _init.Invoke(-1);

            var tableInfo = _config.TableSqlInfos[tableName];
            ILuaConfigSqlInfo sqlInfo;

            tableInfo.Sqls.TryGetValue(sqlName, out sqlInfo);
            return(new LuaSqlConfigExecutor(this, db, _luaSqlParamFuncContainer, tableName, sqlName, sqlInfo, tableInfo, _sqlExecutor,
                                            _sqlParamConverter, _util));
        }
Exemple #7
0
 private TOutput WrapTransformation(TInput row)
 {
     if (!WasInitialized)
     {
         InitAction?.Invoke();
         WasInitialized = true;
         if (!DisableLogging)
         {
             NLogger.Debug(TaskName + " was initialized!", TaskType, "LOG", TaskHash, ControlFlow.ControlFlow.STAGE, ControlFlow.ControlFlow.CurrentLoadProcess?.Id);
         }
     }
     LogProgress();
     return(TransformationFunc.Invoke(row));
 }
Exemple #8
0
        private void Form1_Load(object sender, EventArgs e)
        {
            UiCtx = SynchronizationContext.Current;

            AppForm = this;


            InitAction?.Invoke();

            // Initialize CefSharp
            Cef.Initialize();
            // Create a new browser window
            _browser =
                new ChromiumWebBrowser("http://localhost:5000");
            this.panel2.
            Controls.Add(_browser);
            _browser.LoadingStateChanged += _browser_LoadingStateChanged;
            _browser.LoadError           += _browser_LoadError;
        }
Exemple #9
0
 /// <summary>
 /// 执行相关的策略执行器
 /// </summary>
 public void InvokeExecutors(IDictionary <string, ISqlConfigPolicy> policies,
                             IPolicyExecutorInfo info, Type executorInfoBaseType)
 {
     if (executorInfoBaseType == _tISqlInitPolicyExecutorInfo)
     {
         //在策略执行之前进行相应的初始化操作(优先级排序)
         _sqlInitPolicyExecutorsOrderInit.Invoke(-1);
         DoSqlInitPolicyExecutors(policies, info);
     }
     else if (executorInfoBaseType == _tISqlPreExecutePolicyExecutorInfo)
     {
         _sqlPreExecutePolicyExecutorsOrderInit.Invoke(-1);
         DoSqlPreExecutePolicyExecutors(policies, info);
     }
     else if (executorInfoBaseType == _tISqlExecutePolicyExecutorInfo)
     {
         _sqlExecutePolicyExecutorsOrderInit.Invoke(-1);
         DoSqlExecutePolicyExecutors(policies, info);
     }
     else
     {
         throw new ArgumentException($"Invalid type [{info.GetType().FullName}]", nameof(info));
     }
 }
Exemple #10
0
 /// <summary>
 /// 在上个定时任务执行完毕后,隔1分钟在重新发起一起定时任务
 /// 每次允许2个线程执行
 /// </summary>
 /// <param name="cancellationToken"></param>
 /// <returns></returns>
 public Task StartAsync(CancellationToken cancellationToken)
 {
     m_timer.Change(0, Timeout.Infinite);
     InitAction?.Invoke();
     return(Task.CompletedTask);
 }