Table of Contents

Class DelayChangeToken

Namespace
Acuit.Pinpoint.ResourceManagement
Assembly
Acuit.Pinpoint.ResourceManagement.Abstractions.dll

A change token that indicates change after a time delay.

public sealed class DelayChangeToken : IChangeToken, IDisposable
Inheritance
DelayChangeToken
Implements
Inherited Members

Constructors

DelayChangeToken(TimeSpan, ITimeService)

Initializes a new instance of the DelayChangeToken class.

public DelayChangeToken(TimeSpan delay, ITimeService timeService)

Parameters

delay TimeSpan

The time span to wait before indicating change via the change token.

timeService ITimeService

The time service.

Remarks

If delay is Zero, then the change token will immediately indicate change. Otherwise, the time delay will begin immediately, after which the change token will indicate change.

Exceptions

ArgumentNullException

timeService is null.

ArgumentOutOfRangeException

delay is less than Zero or greater than MaxDelay.

Properties

ActiveChangeCallbacks

Indicates if this token will pro-actively raise callbacks. If false, the token consumer must poll HasChanged to detect changes.

public bool ActiveChangeCallbacks { get; }

Property Value

bool

HasChanged

Gets a value that indicates if a change has occurred.

public bool HasChanged { get; }

Property Value

bool

Methods

Dispose()

Closes and releases all resources used by the object.

public void Dispose()

RegisterChangeCallback(Action<object>, object)

Registers for a callback that will be invoked when the entry has changed. HasChanged MUST be set before the callback is invoked.

public IDisposable RegisterChangeCallback(Action<object> callback, object state)

Parameters

callback Action<object>

The Action<T> to invoke.

state object

State to be passed into the callback.

Returns

IDisposable

An IDisposable that is used to unregister the callback.