C# Class Elders.Hystrix.NET.TryableSemaphore

Semaphore that only supports TryAcquire and never blocks and that supports a dynamic permit count.
Using AtomicInteger increment/decrement instead of java.util.concurrent.Semaphore since we don't need blocking and need a custom implementation to get the dynamic permit count and since AtomicInteger achieves the same behavior and performance without the more complex implementation of the actual Semaphore class using AbstractQueueSynchronizer.
显示文件 Open project: Elders/Hystrix.NET Class Usage Examples

Public Methods

Method Description
GetNumberOfPermitsUsed ( ) : int
Release ( ) : void

Releases the acquired semaphore.

TryAcquire ( ) : bool

Tries to acquire the semaphore.

TryableSemaphore ( IHystrixProperty numberOfPermits ) : Java.Util.Concurrent.Atomic

Method Details

GetNumberOfPermitsUsed() public method

public GetNumberOfPermitsUsed ( ) : int
return int

Release() public method

Releases the acquired semaphore.
public Release ( ) : void
return void

TryAcquire() public method

Tries to acquire the semaphore.
public TryAcquire ( ) : bool
return bool

TryableSemaphore() public method

public TryableSemaphore ( IHystrixProperty numberOfPermits ) : Java.Util.Concurrent.Atomic
numberOfPermits IHystrixProperty
return Java.Util.Concurrent.Atomic