azure-docs-sdk-java/archive/docs-ref-autogen/system.fabric.CancellationT...

109 строки
7.9 KiB
YAML

### YamlMime:JavaType
inheritances:
- <xref href="java.lang.Object" data-throw-if-not-resolved="False"/>
- <xref href="AutoCloseable" data-throw-if-not-resolved="False"/>
methods:
- fullName: system.fabric.CancellationToken.canBeCancelled()
name: canBeCancelled()
nameWithType: CancellationToken.canBeCancelled()
returns:
description: <p>Returns true if the token can be cancelled, else false. </p>
type: <xref href="boolean?alt=boolean&text=boolean" data-throw-if-not-resolved="False"/>
summary: <p>Specifies if the Cancellation token can be cancelled or not. If the <xref uid="" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationToken"></xref> is created using <xref uid="system.fabric.CancellationTokenSource.getToken()" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationTokenSource#getToken()"></xref>, then the token can cancelled using <xref uid="system.fabric.CancellationTokenSource.cancel()" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationTokenSource#cancel()"></xref> method. If the <xref uid="" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationToken"></xref> is created using <xref uid="system.fabric.CancellationToken.getDefault()" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationToken#getDefault()"></xref>, then it can not be cancelled. It simply acts as a dummy token. </p>
syntax: public boolean canBeCancelled()
uid: system.fabric.CancellationToken.canBeCancelled()
- fullName: system.fabric.CancellationToken.close()
name: close()
nameWithType: CancellationToken.close()
syntax: public void close()
uid: system.fabric.CancellationToken.close()
- fullName: system.fabric.CancellationToken.getDefault()
name: getDefault()
nameWithType: CancellationToken.getDefault()
returns:
description: >-
<p>
<xref uid="system.fabric.CancellationToken" data-throw-if-not-resolved="false" data-raw-source="CancellationToken"></xref>
</p>
type: <xref href="system.fabric.CancellationToken?alt=system.fabric.CancellationToken&text=CancellationToken" data-throw-if-not-resolved="False"/>
summary: >-
<p>Creates and returns a Cancellation token object. This method should be used when the CancellationToken doesn't support cancellation. Only Cancellation tokens created through <xref uid="system.fabric.CancellationTokenSource.getToken()" data-throw-if-not-resolved="false" data-raw-source="CancellationTokenSource#getToken()"></xref> supports cancellations.</p>
<p></p>
syntax: public static CancellationToken getDefault()
uid: system.fabric.CancellationToken.getDefault()
- fullName: system.fabric.CancellationToken.isCancelled()
name: isCancelled()
nameWithType: CancellationToken.isCancelled()
returns:
description: <p>boolean cancellation status </p>
type: <xref href="boolean?alt=boolean&text=boolean" data-throw-if-not-resolved="False"/>
summary: >-
<p>Gets whether cancellation has been requested for this token.</p>
<p></p>
syntax: public boolean isCancelled()
uid: system.fabric.CancellationToken.isCancelled()
- fullName: system.fabric.CancellationToken.registerCancellationCallback(Runnable callback)
name: registerCancellationCallback(Runnable callback)
nameWithType: CancellationToken.registerCancellationCallback(Runnable callback)
parameters:
- description: >-
<p>
<xref uid="" data-throw-if-not-resolved="false" data-raw-source="java.lang.Runnable"></xref> to be executed when on token cancel event. </p>
name: callback
type: <xref href="Runnable?alt=Runnable&text=Runnable" data-throw-if-not-resolved="False"/>
summary: <p>Registers a callback which will be executed when this <xref uid="" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationToken"></xref> object is cancelled. </p>
syntax: public void registerCancellationCallback(Runnable callback)
uid: system.fabric.CancellationToken.registerCancellationCallback(Runnable)
- fullName: system.fabric.CancellationToken.registerCancellationCallback(String name, Runnable callback)
name: registerCancellationCallback(String name, Runnable callback)
nameWithType: CancellationToken.registerCancellationCallback(String name, Runnable callback)
parameters:
- description: <p>callback name. </p>
name: name
type: <xref href="String?alt=String&text=String" data-throw-if-not-resolved="False"/>
- description: >-
<p>
<xref uid="" data-throw-if-not-resolved="false" data-raw-source="java.lang.Runnable"></xref> to be executed when on token cancel event. </p>
name: callback
type: <xref href="Runnable?alt=Runnable&text=Runnable" data-throw-if-not-resolved="False"/>
summary: <p>Registers a callback which will be executed when this <xref uid="" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationToken"></xref> object is cancelled. </p>
syntax: public void registerCancellationCallback(String name, Runnable callback)
uid: system.fabric.CancellationToken.registerCancellationCallback(String,Runnable)
- fullName: system.fabric.CancellationToken.throwIfCancellationRequested()
name: throwIfCancellationRequested()
nameWithType: CancellationToken.throwIfCancellationRequested()
summary: <p>Throws a CancellationException if this token has had cancellation requested. </p>
syntax: public void throwIfCancellationRequested()
uid: system.fabric.CancellationToken.throwIfCancellationRequested()
- fullName: system.fabric.CancellationToken.unregisterCancellationCallback()
name: unregisterCancellationCallback()
nameWithType: CancellationToken.unregisterCancellationCallback()
summary: <p>unregister the callback for this <xref uid="" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationToken"></xref> object. </p>
syntax: public void unregisterCancellationCallback()
uid: system.fabric.CancellationToken.unregisterCancellationCallback()
- fullName: system.fabric.CancellationToken.unregisterCancellationCallback(String name)
name: unregisterCancellationCallback(String name)
nameWithType: CancellationToken.unregisterCancellationCallback(String name)
parameters:
- description: <p>callback name registered for this <xref uid="" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationToken"></xref> object. </p>
name: name
type: <xref href="String?alt=String&text=String" data-throw-if-not-resolved="False"/>
summary: <p>unregister the callback for this <xref uid="" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationToken"></xref> object. </p>
syntax: public void unregisterCancellationCallback(String name)
uid: system.fabric.CancellationToken.unregisterCancellationCallback(String)
nameWithType: CancellationToken
syntax: public class CancellationToken
type: class
uid: system.fabric.CancellationToken
fullName: system.fabric.CancellationToken
name: CancellationToken
package: system.fabric
summary: <p>A CancellationToken is used to propagate notification that operations should be canceled. You create a cancellation token by instantiating a <xref uid="system.fabric.CancellationTokenSource" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationTokenSource"></xref> object, which manages cancellation tokens retrieved from its <xref uid="system.fabric.CancellationTokenSource.getToken()" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationTokenSource#getToken()"></xref> method. You then pass the cancellation token to any number of operations that should receive notice of cancellation. The token cannot be used to initiate cancellation. When the owning object calls <xref uid="system.fabric.CancellationTokenSource.cancel()" data-throw-if-not-resolved="false" data-raw-source="system.fabric.CancellationTokenSource#cancel()"></xref>, the cancelled property on the cancellation token is set to true. The objects that receive the notification can respond in whatever manner is appropriate. </p>
metadata: {}