示例#1
0
        public override void Run()
        {
            var success  = false;
            var fileLock = FileLockFactory.GetFileLock(this.LockFile);

            if (Timeout.HasValue)
            {
                success = fileLock.Lock(this.Timeout.Value);
            }
            else
            {
                success = fileLock.Lock();
            }

            if (!success)
            {
                throw new JobExecutionException("Failed to acquire file-lock within the specified timeout");
            }
        }
示例#2
0
 public override void Run() => FileLockFactory.GetFileLock(LockFile).Unlock();