internal bool ExecuteJob(IJob job, out Exception ex)
{
bool success = false;
ex = null;
try
{
// Execute the job, with a timeout if necessary.
int timeout = job.Timeout < 0 ? 60000 : job.Timeout;
if (timeout > 0)
{
this.logger.Info("Worker {0} ({1}) is executing job '{2}' with timeout {3}.", this.name, this.id, job.Name, job.Timeout);
new Action(job.Execute).InvokeWithTimeout(timeout);
}
else
{
this.logger.Info("Worker {0} ({1}) is executing job '{2}' with no timeout.", this.name, this.id, job.Name);
job.Execute();
}
success = true;
}
catch (Exception tx)
{
ex = tx;
}
return success;
}