Show / Hide Table of Contents

Class GrainCancellationTokenSource

Distributed version of the CancellationTokenSource

Inheritance
System.Object
GrainCancellationTokenSource
Namespace: Orleans
Assembly: Orleans.Core.Abstractions.dll
Syntax
public sealed class GrainCancellationTokenSource : IDisposable

Constructors

| Improve this Doc View Source

GrainCancellationTokenSource()

Initializes the GrainCancellationTokenSource.

Declaration
public GrainCancellationTokenSource()

Properties

| Improve this Doc View Source

IsCancellationRequested

Gets whether cancellation has been requested for this GrainCancellationTokenSource.

Declaration
public bool IsCancellationRequested { get; }
Property Value
Type Description
System.Boolean

Whether cancellation has been requested for this GrainCancellationTokenSource.

Remarks

This property indicates whether cancellation has been requested for this token source, such as due to a call to its Cancel() method.

If this property returns true, it only guarantees that cancellation has been requested. It does not guarantee that every handler registered with the corresponding token has finished executing, nor that cancellation requests have finished propagating to all registered handlers and remote targets. Additional synchronization may be required, particularly in situations where related objects are being canceled concurrently.

| Improve this Doc View Source

Token

Gets the GrainCancellationTokenSource associated with this GrainCancellationTokenSource.

Declaration
public GrainCancellationToken Token { get; }
Property Value
Type Description
GrainCancellationToken

The GrainCancellationToken associated with this GrainCancellationToken.

Methods

| Improve this Doc View Source

Cancel()

Communicates a request for cancellation.

Declaration
public Task Cancel()
Returns
Type Description
Task
Remarks

The associated Orleans.Async.GrainCancellationToken will be notified of the cancellation and will transition to a state where CancellationToken returns true. Any callbacks or cancelable operations registered with the Orleans.Threading.CancellationToken will be executed.

Cancelable operations and callbacks registered with the token should not throw exceptions. However, this overload of Cancel will aggregate any exceptions thrown into a , such that one callback throwing an exception will not prevent other registered callbacks from being executed.

The System.Threading.ExecutionContext that was captured when each callback was registered will be reestablished when the callback is invoked.

Exceptions
Type Condition
System.AggregateException

An aggregate exception containing all the exceptions thrown by the registered callbacks on the associated Orleans.Async.GrainCancellationToken.

System.ObjectDisposedException

This Orleans.Async.GrainCancellationTokenSource has been disposed.

| Improve this Doc View Source

Dispose()

Releases the resources used by this Orleans.Async.GrainCancellationTokenSource.

Declaration
public void Dispose()
Remarks

This method is not thread-safe for any other concurrent calls.

Extension Methods

ImmutableExt.AsImmutable<T>(T)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX