示例#1
0
文件: CronEngine.cs 项目: s72785/des
        }         // func ExecuteJobAsync

        private void FinishJob(CurrentRunningJob jobRunning, Exception jobException)
        {
            lock (cronItemCache)
            {
                using (EnterReadLock())
                    using (currentJobs.EnterWriteLock())
                    {
                        var jobBound = jobRunning.Job as ICronJobItem;

                        // remove job from running jobs
                        currentJobs.Remove(jobRunning);

                        // generate log entry
                        var name = jobBound == null ? "<unnamed>" : jobBound.DisplayName;
                        if (jobException != null)
                        {
                            Log.Except(String.Format("jobfinish: {0}", name), jobException);
                            var node = jobRunning.Job as DEConfigLogItem;
                            if (node != null)
                            {
                                var aggException = jobException as AggregateException;
                                if (aggException != null)
                                {
                                    if (aggException.InnerException != null)
                                    {
                                        node.Log.Except("Execution failed.", aggException.InnerException);
                                    }
                                    foreach (var ex in aggException.InnerExceptions)
                                    {
                                        node.Log.Except("Execution failed.", ex);
                                    }
                                }
                                else
                                {
                                    node.Log.Except("Execution failed.", jobException);
                                }
                            }
                        }
                        else
                        {
                            Log.Info("jobfinish: {0}", name);
                        }

                        // calculate next runtime
                        if (jobBound != null && !jobBound.Bound.IsEmpty && cronItemCache != null)
                        {
                            var index = Array.FindIndex(cronItemCache, c => c.Job == jobBound);
                            if (index >= 0)
                            {
                                var next = jobBound.Bound.GetNext(DateTime.Now);
                                cronItemCache[index].NextRun = next;
                                jobBound.NotifyNextRun(next);
                                SaveNextRuntime();
                            }
                        }
                    }
            }
        }         // proc FinishJob
示例#2
0
 private void RemoveEventSession(EventSession eventSession)
 => eventSessions.Remove(eventSession);
示例#3
0
        }         // func GetAttachedGlobals

        private void RemoveAttachedGlobal(LuaAttachedGlobal item)
        {
            lock (globals)
                globals.Remove(item);
        }         // func RemoveAttachedGlobal
示例#4
0
        }         // proc AddScript

        private void RemoveScript(LuaScript script)
        {
            lock (scripts)
                scripts.Remove(script);
        }         // proc RemoveScript
示例#5
0
 private void RemoveEventSession(EventSession eventSession)
 {
     using (eventSessions.EnterWriteLock())
         eventSessions.Remove(eventSession);
 }         // proc RemoveEventSession
示例#6
0
        }         // func CreateConnection

        private void RemoveConnection(ConnectionTcp connection)
        {
            connections.Remove(connection);
        }         // proc RemoveConnection