Example #1
0
 /// <summary>Called by a runner process to signal end of job</summary>
 /// <param name="sender">The sender</param>
 /// <param name="args">The command arguments</param>
 private void OnEndJob(object sender, SocketServer.CommandArgs args)
 {
     try
     {
         EndJobArguments arguments            = args.obj as EndJobArguments;
         JobCompleteArgs jobCompleteArguments = new JobCompleteArgs();
         jobCompleteArguments.job = runningJobs[arguments.key];
         if (arguments.errorMessage != null)
         {
             jobCompleteArguments.exceptionThrowByJob = new Exception(arguments.errorMessage);
         }
         lock (this)
         {
             if (JobCompleted != null)
             {
                 JobCompleted.Invoke(this, jobCompleteArguments);
             }
             runningJobs.Remove(arguments.key);
         }
         server.Send(args.socket, "OK");
     }
     catch (Exception err)
     {
         errors += err.ToString() + Environment.NewLine;
     }
 }
Example #2
0
        /// <summary>Called by the client to get the next job to run.</summary>
        /// <param name="sender">The sender</param>
        /// <param name="args">The command arguments</param>
        private void OnEndJob(object sender, SocketServer.CommandArgs args)
        {
            EndJobArguments arguments = args.obj as EndJobArguments;

            lock (this)
            {
                SetJobCompleted(arguments.key, arguments.errorMessage);
            }
            server.Send(args.socket, "OK");
        }