reactor.core.scheduler.Schedulers.cache()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中reactor.core.scheduler.Schedulers.cache()方法的一些代码示例,展示了Schedulers.cache()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Schedulers.cache()方法的具体详情如下:
包路径:reactor.core.scheduler.Schedulers
类名称:Schedulers
方法名:cache

Schedulers.cache介绍

[英]Get a CachedScheduler out of the reference or create one using the Supplier if the reference is empty, effectively creating a single instance to be reused as a default scheduler for the given key category.
[中]从引用中获取CachedScheduler,或者在引用为空的情况下使用供应商创建一个CachedScheduler,从而有效地创建一个实例,以重用为给定密钥类别的默认调度器。

代码示例

代码示例来源:origin: reactor/reactor-core

/**
 * {@link Scheduler} that hosts a fixed pool of single-threaded ExecutorService-based
 * workers and is suited for parallel work.
 *
 * @return default instance of a {@link Scheduler} that hosts a fixed pool of single-threaded
 * ExecutorService-based workers
 */
public static Scheduler parallel() {
  return cache(CACHED_PARALLEL, PARALLEL, PARALLEL_SUPPLIER);
}

代码示例来源:origin: reactor/reactor-core

/**
 * {@link Scheduler} that hosts a single-threaded ExecutorService-based worker and is
 * suited for parallel work. Will cache the returned schedulers for subsequent calls until dispose.
 *
 * @return default instance of a {@link Scheduler} that hosts a single-threaded
 * ExecutorService-based worker
 */
public static Scheduler single() {
  return cache(CACHED_SINGLE, SINGLE, SINGLE_SUPPLIER);
}

代码示例来源:origin: reactor/reactor-core

/**
 * {@link Scheduler} that dynamically creates ExecutorService-based Workers and caches
 * the thread pools, reusing them once the Workers have been shut down.
 * <p>
 * The maximum number of created thread pools is unbounded.
 * <p>
 * The default time-to-live for unused thread pools is 60 seconds, use the appropriate
 * factory to set a different value.
 * <p>
 * This scheduler is not restartable.
 *
 * @return default instance of a {@link Scheduler} that hosts a fixed pool of single-threaded
 * ExecutorService-based workers and is suited for parallel work
 */
public static Scheduler elastic() {
  return cache(CACHED_ELASTIC, ELASTIC, ELASTIC_SUPPLIER);
}

代码示例来源:origin: io.projectreactor/reactor-core

/**
 * {@link Scheduler} that hosts a fixed pool of single-threaded ExecutorService-based
 * workers and is suited for parallel work.
 *
 * @return default instance of a {@link Scheduler} that hosts a fixed pool of single-threaded
 * ExecutorService-based workers
 */
public static Scheduler parallel() {
  return cache(CACHED_PARALLEL, PARALLEL, PARALLEL_SUPPLIER);
}

代码示例来源:origin: io.projectreactor/reactor-core

/**
 * {@link Scheduler} that hosts a single-threaded ExecutorService-based worker and is
 * suited for parallel work. Will cache the returned schedulers for subsequent calls until dispose.
 *
 * @return default instance of a {@link Scheduler} that hosts a single-threaded
 * ExecutorService-based worker
 */
public static Scheduler single() {
  return cache(CACHED_SINGLE, SINGLE, SINGLE_SUPPLIER);
}

代码示例来源:origin: io.projectreactor/reactor-core

/**
 * {@link Scheduler} that dynamically creates ExecutorService-based Workers and caches
 * the thread pools, reusing them once the Workers have been shut down.
 * <p>
 * The maximum number of created thread pools is unbounded.
 * <p>
 * The default time-to-live for unused thread pools is 60 seconds, use the appropriate
 * factory to set a different value.
 * <p>
 * This scheduler is not restartable.
 *
 * @return default instance of a {@link Scheduler} that hosts a fixed pool of single-threaded
 * ExecutorService-based workers and is suited for parallel work
 */
public static Scheduler elastic() {
  return cache(CACHED_ELASTIC, ELASTIC, ELASTIC_SUPPLIER);
}

相关文章