Udostępnij za pośrednictwem


ThreadPoolExecutor.Remove(IRunnable) Method

Definition

Removes this task from the executor's internal queue if it is present, thus causing it not to be run if it has not already started.

[Android.Runtime.Register("remove", "(Ljava/lang/Runnable;)Z", "GetRemove_Ljava_lang_Runnable_Handler")]
public virtual bool Remove (Java.Lang.IRunnable? task);
[<Android.Runtime.Register("remove", "(Ljava/lang/Runnable;)Z", "GetRemove_Ljava_lang_Runnable_Handler")>]
abstract member Remove : Java.Lang.IRunnable -> bool
override this.Remove : Java.Lang.IRunnable -> bool

Parameters

task
IRunnable

the task to remove

Returns

true if the task was removed

Attributes

Remarks

Removes this task from the executor's internal queue if it is present, thus causing it not to be run if it has not already started.

This method may be useful as one part of a cancellation scheme. It may fail to remove tasks that have been converted into other forms before being placed on the internal queue. For example, a task entered using submit might be converted into a form that maintains Future status. However, in such cases, method #purge may be used to remove those Futures that have been cancelled.

Java documentation for java.util.concurrent.ThreadPoolExecutor.remove(java.lang.Runnable).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to