Esempio n. 1
0
        }         // 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
Esempio n. 2
0
 private void RemoveEventSession(EventSession eventSession)
 => eventSessions.Remove(eventSession);
Esempio n. 3
0
        }         // func GetAttachedGlobals

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

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

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