AbstractExecutorService 类

定义

提供执行方法的默认实现 ExecutorService

[Android.Runtime.Register("java/util/concurrent/AbstractExecutorService", DoNotGenerateAcw=true)]
public abstract class AbstractExecutorService : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.Util.Concurrent.IExecutorService
[<Android.Runtime.Register("java/util/concurrent/AbstractExecutorService", DoNotGenerateAcw=true)>]
type AbstractExecutorService = class
    inherit Object
    interface IExecutorService
    interface IExecutor
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
继承
AbstractExecutorService
派生
属性
实现

注解

提供执行方法的默认实现 ExecutorService 。 此类使用submitinvokeAnyRunnableFuture返回的实现newTaskFor方法invokeAll,该方法默认为FutureTask此包中提供的类。 例如,创建的实现 submit(Runnable) 是执行并返回的关联 RunnableFuture 。 子类可以重写 newTaskFor 方法以返回 RunnableFuture 其他 FutureTask实现。

<b>扩展示例。</b> 下面是自定义为使用CustomTask类而不是默认FutureTask类的类ThreadPoolExecutor的草图:

{@code
            public class CustomThreadPoolExecutor extends ThreadPoolExecutor {

              static class CustomTask<V> implements RunnableFuture<V> { ... }

              protected <V> RunnableFuture<V> newTaskFor(Callable<V> c) {
                  return new CustomTask<V>(c);
              }
              protected <V> RunnableFuture<V> newTaskFor(Runnable r, V v) {
                  return new CustomTask<V>(r, v);
              }
              // ... add constructors, etc.
            }}

在 1.5 中添加。

Java文档java.util.concurrent.AbstractExecutorService

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

构造函数

名称 说明
AbstractExecutorService()

要调用的子类的构造函数。

AbstractExecutorService(IntPtr, JniHandleOwnership)

创建 JNI 对象的托管表示形式时使用的构造函数;由运行时调用。

属性

名称 说明
Class

返回此 Object的运行时类。

(继承自 Object)
Handle

基础 Android 实例的句柄。

(继承自 Object)
IsShutdown

提供执行方法的默认实现 ExecutorService

IsTerminated

提供执行方法的默认实现 ExecutorService

JniIdentityHashCode

提供执行方法的默认实现 ExecutorService

(继承自 Object)
JniPeerMembers

提供执行方法的默认实现 ExecutorService

PeerReference

提供执行方法的默认实现 ExecutorService

(继承自 Object)
ThresholdClass

此 API 支持 Mono for Android 基础结构,不打算直接从代码使用。

ThresholdType

此 API 支持 Mono for Android 基础结构,不打算直接从代码使用。

方法

名称 说明
AwaitTermination(Int64, TimeUnit)

阻止,直到所有任务在关闭请求后完成执行,或者超时发生,或者当前线程中断,以先发生。

AwaitTerminationAsync(Int64, TimeUnit)

提供执行方法的默认实现 ExecutorService

Clone()

创建并返回此对象的副本。

(继承自 Object)
Dispose()

提供执行方法的默认实现 ExecutorService

(继承自 Object)
Dispose(Boolean)

提供执行方法的默认实现 ExecutorService

(继承自 Object)
Equals(Object)

指示其他对象是否“等于”此对象。

(继承自 Object)
Execute(IRunnable)

在将来的某个时间执行给定的命令。

GetHashCode()

返回对象的哈希代码值。

(继承自 Object)
InvokeAll(ICollection, Int64, TimeUnit)

提供执行方法的默认实现 ExecutorService

InvokeAll(ICollection)

提供执行方法的默认实现 ExecutorService

InvokeAny(ICollection, Int64, TimeUnit)

提供执行方法的默认实现 ExecutorService

InvokeAny(ICollection)

提供执行方法的默认实现 ExecutorService

JavaFinalize()

当垃圾回收确定不再引用该对象时,由对象上的垃圾回收器调用。

(继承自 Object)
NewTaskFor(ICallable)

返回 RunnableFuture 给定的可调用任务。

NewTaskFor(IRunnable, Object)

返回 RunnableFuture 给定的可运行值和默认值。

Notify()

唤醒正在等待此对象的监视器的单个线程。

(继承自 Object)
NotifyAll()

唤醒正在等待此对象的监视器的所有线程。

(继承自 Object)
SetHandle(IntPtr, JniHandleOwnership)

设置 Handle 属性。

(继承自 Object)
Shutdown()

启动有序关闭,在该关闭中执行以前提交的任务,但不会接受任何新任务。

ShutdownNow()

尝试停止所有主动执行的任务,停止正在等待的任务的处理,并返回等待执行的任务的列表。

Submit(ICallable)

提供执行方法的默认实现 ExecutorService

Submit(IRunnable, Object)

提供执行方法的默认实现 ExecutorService

Submit(IRunnable)

提交可运行的任务以供执行,并返回表示该任务的 Future。

ToArray<T>()

提供执行方法的默认实现 ExecutorService

(继承自 Object)
ToString()

返回对象的字符串表示形式。

(继承自 Object)
UnregisterFromRuntime()

提供执行方法的默认实现 ExecutorService

(继承自 Object)
Wait()

使当前线程等待,直到唤醒它,通常是通过 em 通知/em< 或 >em<interrupted>/em<。><>

(继承自 Object)
Wait(Int64, Int32)

使当前线程等待直到唤醒,通常是通过 <em>通知</em> 或 <em interrupted>/em<>,或直到经过一定数量的实时。

(继承自 Object)
Wait(Int64)

使当前线程等待直到唤醒,通常是通过 <em>通知</em> 或 <em interrupted>/em<>,或直到经过一定数量的实时。

(继承自 Object)

显式接口实现

名称 说明
IJavaPeerable.Disposed()

提供执行方法的默认实现 ExecutorService

(继承自 Object)
IJavaPeerable.DisposeUnlessReferenced()

提供执行方法的默认实现 ExecutorService

(继承自 Object)
IJavaPeerable.Finalized()

提供执行方法的默认实现 ExecutorService

(继承自 Object)
IJavaPeerable.JniManagedPeerState

提供执行方法的默认实现 ExecutorService

(继承自 Object)
IJavaPeerable.SetJniIdentityHashCode(Int32)

提供执行方法的默认实现 ExecutorService

(继承自 Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates)

提供执行方法的默认实现 ExecutorService

(继承自 Object)
IJavaPeerable.SetPeerReference(JniObjectReference)

提供执行方法的默认实现 ExecutorService

(继承自 Object)

扩展方法

名称 说明
AwaitTerminationAsync(IExecutorService, Int64, TimeUnit)

提供执行方法的默认实现 ExecutorService

GetJniTypeName(IJavaPeerable)

获取实例 self类型的 JNI 名称。

InvokeAnyAsync(IExecutorService, ICollection, Int64, TimeUnit)

提供执行方法的默认实现 ExecutorService

InvokeAnyAsync(IExecutorService, ICollection)

提供执行方法的默认实现 ExecutorService

JavaAs<TResult>(IJavaPeerable)

尝试强制self键入TResult,检查强制是否在Java端有效。

JavaCast<TResult>(IJavaObject)

执行 Android 运行时检查的类型转换。

JavaCast<TResult>(IJavaObject)

提供执行方法的默认实现 ExecutorService

TryJavaCast<TResult>(IJavaPeerable, TResult)

尝试强制self键入TResult,检查强制是否在Java端有效。

适用于