接口的使用
java.util.concurrent.Executor
使用 Executor 的包
包
描述
提供简单的高级 Http 服务 API,可用于构建嵌入式 HTTP 服务。
HTTP 客户端和 WebSocket API
提供使用 Java 编程语言访问和处理存储在数据源(通常是关系数据库)中的数据的 API。
通常在并发编程中有用的实用程序类。
为 Java 管理扩展提供核心类。
-
Executor 在 com.sun.net.httpserver 中的用法
com.sun.net.httpserver 中返回 Executor 的方法com.sun.net.httpserver 中的方法,参数类型为 Executor -
Executor 在 java.net.http 中的用法
返回类型中包含 Executor 类型参数的 java.net.http 中的方法java.net.http 中的方法,参数类型为 Executor -
Executor 在 java.sql 中的用法
修饰符和类型方法描述void终止打开的连接。voidConnection.setNetworkTimeout(Executor executor, int milliseconds) 设置Connection或从Connection创建的对象将等待数据库回复任何一个请求的最长期限。 -
Executor 在 java.util.concurrent 中的用法
java.util.concurrent 中 Executor 的子接口java.util.concurrent 中实现 Executor 的类修饰符和类型类描述class提供ExecutorService执行方法的默认实现。class用于运行ForkJoinTask的ExecutorService。classThreadPoolExecutor可以额外安排命令在给定延迟后运行,或定期执行。class一个ExecutorService,它使用可能的几个池线程之一执行每个提交的任务,通常使用Executors工厂方法配置。java.util.concurrent 中返回 Executor 的方法修饰符和类型方法描述CompletableFuture.defaultExecutor()返回用于未指定执行器的异步方法的默认执行器。static ExecutorCompletableFuture.delayedExecutor(long delay, TimeUnit unit) 返回一个新的 Executor,它在给定的延迟(如果为非正数则没有延迟)后将任务提交给默认执行器。static ExecutorCompletableFuture.delayedExecutor(long delay, TimeUnit unit, Executor executor) 返回一个新的 Executor,它在给定的延迟后(如果为非正则则不延迟)向给定的基本执行器提交任务。SubmissionPublisher.getExecutor()返回用于异步传递的执行器。java.util.concurrent 中的方法,参数类型为 Executor修饰符和类型方法描述CompletableFuture.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) CompletionStage.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) 返回一个新的 CompletionStage,当这个或另一个给定阶段正常完成时,使用提供的执行器执行,并将相应的结果作为提供的操作的参数。<U> CompletableFuture<U>CompletableFuture.applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) <U> CompletionStage<U>CompletionStage.applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) 返回一个新的 CompletionStage,当这个或另一个给定阶段正常完成时,使用提供的执行器执行,并将相应的结果作为提供函数的参数。CompletableFuture.completeAsync(Supplier<? extends T> supplier, Executor executor) 使用给定的执行程序从异步任务调用的给定供应商函数的结果完成此 CompletableFuture。static ExecutorCompletableFuture.delayedExecutor(long delay, TimeUnit unit, Executor executor) 返回一个新的 Executor,它在给定的延迟后(如果为非正则则不延迟)向给定的基本执行器提交任务。default CompletionStage<T>CompletionStage.exceptionallyAsync(Function<Throwable, ? extends T> fn, Executor executor) 时,使用提供的 Executor 将这个阶段的异常作为提供的函数的参数执行。default CompletionStage<T>CompletionStage.exceptionallyComposeAsync(Function<Throwable, ? extends CompletionStage<T>> fn, Executor executor) 返回一个新的 CompletionStage,当这个阶段异常完成时,使用提供的执行器使用提供的函数的结果应用到这个阶段的异常。<U> CompletableFuture<U>CompletableFuture.handleAsync(BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) <U> CompletionStage<U>CompletionStage.handleAsync(BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) 返回一个新的 CompletionStage,当此阶段正常或异常完成时,使用提供的执行程序执行该阶段的结果和异常作为提供函数的参数。CompletableFuture.runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) CompletionStage.runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) 返回一个新的 CompletionStage,当这个阶段和另一个给定阶段都正常完成时,使用提供的执行程序执行给定的操作。CompletableFuture.runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) CompletionStage.runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) 返回一个新的 CompletionStage,当这个或另一个给定阶段正常完成时,使用提供的执行程序执行给定的操作。static CompletableFuture<Void>返回一个新的 CompletableFuture,它在运行给定操作后由在给定执行器中运行的任务异步完成。static <U> CompletableFuture<U>CompletableFuture.supplyAsync(Supplier<U> supplier, Executor executor) 返回一个新的 CompletableFuture,它由在给定执行器中运行的任务异步完成,其值是通过调用给定供应商获得的。CompletableFuture.thenAcceptAsync(Consumer<? super T> action, Executor executor) CompletionStage.thenAcceptAsync(Consumer<? super T> action, Executor executor) 返回一个新的 CompletionStage,当这个阶段正常完成时,使用提供的 Executor 执行,这个阶段的结果作为提供的操作的参数。<U> CompletableFuture<Void>CompletableFuture.thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) <U> CompletionStage<Void>CompletionStage.thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) 返回一个新的 CompletionStage,当这个和另一个给定阶段都正常完成时,使用提供的执行器执行,两个结果作为提供的操作的参数。<U> CompletableFuture<U>CompletableFuture.thenApplyAsync(Function<? super T, ? extends U> fn, Executor executor) <U> CompletionStage<U>CompletionStage.thenApplyAsync(Function<? super T, ? extends U> fn, Executor executor) 返回一个新的 CompletionStage,当这个阶段正常完成时,使用提供的 Executor 执行,这个阶段的结果作为提供函数的参数。<U,V> CompletableFuture<V> CompletableFuture.thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) <U,V> CompletionStage<V> CompletionStage.thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) 返回一个新的 CompletionStage,当这个和另一个给定阶段都正常完成时,使用提供的执行器执行,两个结果作为提供函数的参数。<U> CompletableFuture<U>CompletableFuture.thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) <U> CompletionStage<U>CompletionStage.thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) 返回一个新的 CompletionStage,它的完成值与给定函数返回的 CompletionStage 相同,使用提供的 Executor 执行。CompletableFuture.thenRunAsync(Runnable action, Executor executor) CompletionStage.thenRunAsync(Runnable action, Executor executor) 返回一个新的 CompletionStage,当这个阶段正常完成时,使用提供的执行器执行给定的操作。CompletableFuture.whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action, Executor executor) CompletionStage.whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action, Executor executor) 返回一个与此阶段具有相同结果或异常的新 CompletionStage,当此阶段完成时,它使用提供的 Executor 执行给定的操作。java.util.concurrent 中的构造函数,参数类型为 Executor修饰符构造方法描述ExecutorCompletionService(Executor executor) 使用提供的执行程序创建一个 ExecutorCompletionService 来执行基本任务,并使用LinkedBlockingQueue作为完成队列。ExecutorCompletionService(Executor executor, BlockingQueue<Future<V>> completionQueue) 使用提供的执行器执行基本任务并使用提供的队列作为其完成队列创建 ExecutorCompletionService。SubmissionPublisher(Executor executor, int maxBufferCapacity) 使用给定的 Executor 创建一个新的 SubmissionPublisher 以异步交付给订阅者,每个订阅者具有给定的最大缓冲区大小,并且在方法onNext中没有订阅者异常的处理程序。SubmissionPublisher(Executor executor, int maxBufferCapacity, BiConsumer<? super Flow.Subscriber<? super T>, ? super Throwable> handler) 使用给定的 Executor 创建一个新的 SubmissionPublisher 以异步交付给订阅者,每个订阅者具有给定的最大缓冲区大小,如果不为空,则当任何订阅者在方法onNext中抛出异常时调用给定的处理程序。 -
Executor 在 javax.management 中的用法
javax.management 中的构造函数,参数类型为 Executor修饰符构造方法描述NotificationBroadcasterSupport(Executor executor) 构造一个 NotificationBroadcasterSupport,其中使用给定的Executor调用每个监听器。NotificationBroadcasterSupport(Executor executor, MBeanNotificationInfo... info) 构造一个 NotificationBroadcasterSupport,其中包含有关可能发送的通知的信息,以及使用给定的Executor调用每个监听器的位置。