/// <summary>
        /// Releases the specified job lock.
        /// </summary>
        /// <param name="jobLock">The job lock.</param>
        public override void Release(JobLock jobLock)
        {
            lock (_myLock)
            {
                if (jobLock.LockAcquired)
                    _locks.Remove(jobLock.LockName);

                jobLock.SetReleased();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Releases the specified job lock.
        /// </summary>
        /// <param name="jobLock">The job lock.</param>
        public override void Release(JobLock jobLock)
        {
            lock (_myLock)
            {
                if (jobLock.LockAcquired)
                {
                    _locks.Remove(jobLock.LockName);
                }

                jobLock.SetReleased();
            }
        }
        public override void Release(JobLock jobLock)
        {
            if (!jobLock.LockAcquired) {
                if (Settings.Current.LogJobLocks) {
                    string processName = "{Unknown}";
                    int processId = 0;
                    try {
                        Process p = Process.GetCurrentProcess();
                        processId = p.Id;
                        processName = p.ProcessName;
                    } catch {}
                    Log.Debug().Message("Tried to release job lock '{0}' that wasn't acquired on {1}; process {2}:{3}",
                        jobLock.LockName, Environment.MachineName, processName, processId).Write();
                }

                return;
            }

            try {
                _jobLockRepository.RemoveByName(jobLock.LockName);
            } catch (Exception e) {
                Log.Error().Message("Error attempting to release job lock '{0}' on {1}.", jobLock.LockName, Environment.MachineName).Exception(e).Report().Write();
            }

            if (Settings.Current.LogJobLocks) {
                string processName = "{Unknown}";
                int processId = 0;
                try {
                    Process p = Process.GetCurrentProcess();
                    processId = p.Id;
                    processName = p.ProcessName;
                } catch {}
                Log.Debug().Message("Released job lock '{0}' on {1}; process {2}:{3}",
                    jobLock.LockName, Environment.MachineName, processName, processId).Write();
            }

            jobLock.SetReleased();
        }
 /// <summary>
 /// Releases the specified job lock.
 /// </summary>
 /// <param name="jobLock">The job lock.</param>
 public abstract void Release(JobLock jobLock);
 /// <summary>
 /// Releases the specified job lock.
 /// </summary>
 /// <param name="jobLock">The job lock.</param>
 public abstract void Release(JobLock jobLock);