C# Class Kudu.Core.Infrastructure.LockFile

Inheritance: IOperationLock
显示文件 Open project: projectkudu/kudu Class Usage Examples

Public Methods

Method Description
InitializeAsyncLocks ( ) : void
Lock ( string operationName ) : bool
LockAsync ( string operationName ) : System.Threading.Tasks.Task

Returns a lock right away or waits asynchronously until a lock is available.

LockFile ( string path ) : System
LockFile ( string path, ITraceFactory traceFactory ) : System
Release ( ) : void
TerminateAsyncLocks ( ) : void

Because of a bug in Ninject in how it disposes objects in the global scope for each request we can't use Dispose to shut down the file system watcher. Otherwise this would get disposed on every request.

Protected Methods

Method Description
OnLockAcquired ( ) : void
OnLockRelease ( ) : void

Private Methods

Method Description
DeleteFileSafe ( ) : void
OnLockReleasedInternal ( object sender, FileSystemEventArgs e ) : void

When a lock file change has been detected we check whether there are queued up lock requests. If so then we attempt to get the lock and dequeue the next request.

ReadLockInfo ( ) : OperationLockInfo
TraceIfUnknown ( Exception ex ) : void
WriteLockInfo ( string operationName, Stream lockStream ) : void

Method Details

InitializeAsyncLocks() public method

public InitializeAsyncLocks ( ) : void
return void

Lock() public method

public Lock ( string operationName ) : bool
operationName string
return bool

LockAsync() public method

Returns a lock right away or waits asynchronously until a lock is available.
public LockAsync ( string operationName ) : System.Threading.Tasks.Task
operationName string
return System.Threading.Tasks.Task

LockFile() public method

public LockFile ( string path ) : System
path string
return System

LockFile() public method

public LockFile ( string path, ITraceFactory traceFactory ) : System
path string
traceFactory ITraceFactory
return System

OnLockAcquired() protected method

protected OnLockAcquired ( ) : void
return void

OnLockRelease() protected method

protected OnLockRelease ( ) : void
return void

Release() public method

public Release ( ) : void
return void

TerminateAsyncLocks() public method

Because of a bug in Ninject in how it disposes objects in the global scope for each request we can't use Dispose to shut down the file system watcher. Otherwise this would get disposed on every request.
public TerminateAsyncLocks ( ) : void
return void