, ExecutorServiceFactory {
- private static final CachedThreadPoolExecutorServiceFactory INSTANCE =
- new CachedThreadPoolExecutorServiceFactory();
+ private static final FixedThreadPoolExecutorServiceFactory INSTANCE =
+ new FixedThreadPoolExecutorServiceFactory();
@Override
public ExecutorServiceFactory create(PipelineOptions options) {
@@ -39,6 +40,6 @@ public ExecutorServiceFactory create(PipelineOptions options) {
@Override
public ExecutorService create() {
- return Executors.newCachedThreadPool();
+ return Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
}
}
diff --git a/runners/direct-java/src/main/java/org/apache/beam/runners/direct/InProcessPipelineOptions.java b/runners/direct-java/src/main/java/org/apache/beam/runners/direct/InProcessPipelineOptions.java
index 512b3bdb7c66..049852188953 100644
--- a/runners/direct-java/src/main/java/org/apache/beam/runners/direct/InProcessPipelineOptions.java
+++ b/runners/direct-java/src/main/java/org/apache/beam/runners/direct/InProcessPipelineOptions.java
@@ -43,13 +43,13 @@ public interface InProcessPipelineOptions extends PipelineOptions, ApplicationNa
* it cannot enter a state in which it will not schedule additional pending work unless currently
* scheduled work completes, as this may cause the {@link Pipeline} to cease processing.
*
- * Defaults to a {@link CachedThreadPoolExecutorServiceFactory}, which produces instances of
+ *
Defaults to a {@link FixedThreadPoolExecutorServiceFactory}, which produces instances of
* {@link Executors#newCachedThreadPool()}.
*/
@JsonIgnore
@Required
@Hidden
- @Default.InstanceFactory(CachedThreadPoolExecutorServiceFactory.class)
+ @Default.InstanceFactory(FixedThreadPoolExecutorServiceFactory.class)
ExecutorServiceFactory getExecutorServiceFactory();
void setExecutorServiceFactory(ExecutorServiceFactory executorService);
diff --git a/sdks/java/core/pom.xml b/sdks/java/core/pom.xml
index 07fd0b1be0c6..aa7edb5a4f98 100644
--- a/sdks/java/core/pom.xml
+++ b/sdks/java/core/pom.xml
@@ -124,6 +124,16 @@
maven-compiler-plugin