BlueCollar.Worker.CancelCurrent C# (CSharp) Méthode

CancelCurrent() private méthode

Cancels the current job.
private CancelCurrent ( ) : void
Résultat void
        internal void CancelCurrent()
        {
            lock (this.runLocker)
            {
                this.KillRunThread();

                if (this.currentRecord != null)
                {
                    this.logger.Info("Worker {0} ({1}) canceled '{2}'.", this.name, this.id, this.currentRecord.JobName);

                    using (IRepository repository = this.repositoryFactory.Create())
                    {
                        using (IDbTransaction transaction = repository.BeginTransaction())
                        {
                            HistoryRecord history = CreateHistory(this.currentRecord, HistoryStatus.Canceled);
                            repository.DeleteWorking(this.currentRecord.Id.Value, transaction);
                            history = repository.CreateHistory(history, transaction);
                            transaction.Commit();
                        }
                    }

                    this.currentRecord = null;
                }

                this.runThread = new Thread(this.RunLoop);
                this.runThread.Name = "BlueCollar Run Thread";
                this.runThread.Start();
            }
        }