예제 #1
0
        public static void CompileScript(string scriptPath, ref IDisposable compiled)
        {
            SimpleLogging.LogMessage("scriptserver compiling linkpad script: " + scriptPath);
            try
            {
                var dbCtx = LINQPad.Util.Compile(scriptPath, false);

                compiled = dbCtx;
            }
            catch (Exception e)
            {
                SimpleExceptionHandling.HandleException(e);
            }
        }
예제 #2
0
        public static object ReRunScript(object[] args, ScriptCacheItem script)
        {
            var result = (script.CompiledScript as LINQPad.ObjectModel.QueryCompilation).Run(LINQPad.QueryResultFormat.Text, args);

            if (result.Exception != null)
            {
                SimpleLogging.LogMessage(script.ScriptFile + " run returned with exception.");
                SimpleExceptionHandling.HandleException(result.Exception);
                return(result.Exception);
            }
            else
            {
                return(result.ReturnValue);
            }
        }
예제 #3
0
 void ShortTermJobQueue_DoWork(object sender, DoWorkEventArgs e)
 {
     SimpleLogging.LogMessage("ShortTermJobQueue starting......");
     try
     {
         while (!this.CancellationPending)
         {
             StartJobs();
             System.Threading.Thread.Sleep(500);  // Runs every 1/2.
         }
     }
     catch (Exception stjqe)
     {
         SimpleExceptionHandling.HandleException(stjqe, "Background");
         throw stjqe;
     }
 }
        void ScriptDisposeBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            // Going to wait 4 second to let all other threads finish running the script.
            System.Threading.Thread.Sleep(4000);


            if (ConfigurationManager.AppSettings["debug"] != null && ConfigurationManager.AppSettings["debug"] == "true")
            {
                SimpleLogging.LogMessage("ScriptDisposeBackgroundWorker disposing: " + CachedScript.ScriptFile + " requesting thread=" + this.RequestingThreadId.ToString());
            }

            try
            {
                CachedScript.CompiledScript.Dispose();

                CachedScript.CompiledScript = null;
            }
            catch (System.Threading.AbandonedMutexException ex)
            {
                // Oh well.....  Just eat it.
                SimpleLogging.LogMessage("Exception displosing script.");
                SimpleExceptionHandling.HandleException(ex);
            }
        }