Exemple #1
0
        private void HttpDumpLoadAction(IDEContext r, int id = -1)
        {
            // get the dump file
            DumpFileInfo di = null;

            using (dumpFiles.EnterReadLock())
            {
                var index = dumpFiles.FindIndex(c => c.Id == id);
                if (index >= 0)
                {
                    di = dumpFiles[index];
                }
            }

            // send the file
            if (di == null)
            {
                throw new ArgumentException("dump id is wrong.");
            }
            var fi = new FileInfo(di.FileName);

            if (!fi.Exists)
            {
                throw new ArgumentException("dump id is invalid.");
            }

            r.SetAttachment(fi.Name)
            .WriteFile(fi.FullName, MimeTypes.Application.OctetStream + ";gzip");
        }         // HttpDumpLoadAction
Exemple #2
0
        }         // proc StartJob

        public Task ExecuteJobAsync(ICronJobExecute job, CancellationToken cancellation)
        {
            using (currentJobs.EnterWriteLock())
            {
                if (currentJobs.FindIndex(c => job == c.Job) >= 0)
                {
                    throw new InvalidOperationException("Job is already running.");
                }

                using (currentJobs.EnterReadLock())
                {
                    foreach (var j in currentJobs)
                    {
                        if (!job.CanRunParallelTo(j.Job))
                        {
                            throw new InvalidOperationException(String.Format("Job is blocked (job: {0})", j.Job.DisplayName));
                        }
                    }
                }

                Log.Info("jobstart: {0}", job.DisplayName);
                var currentJob = new CurrentRunningJob(this, job, cancellation);
                currentJobs.Add(currentJob);
                return(currentJob.Task);
            }
        }         // func ExecuteJobAsync
Exemple #3
0
        }         // proc RemoveScript

        private LuaScript FindScript(string scriptId)
        {
            lock (scripts)
            {
                var index = scripts.FindIndex(s => String.Compare(s.ScriptId, scriptId, StringComparison.OrdinalIgnoreCase) == 0);
                return(index >= 0 ? scripts[index] : null);
            }
        }         // func FindScript