Skip to content

Commit d2ad0ed

Browse files
committed
2 parents 2fbc0ea + e406949 commit d2ad0ed

File tree

5 files changed

+47
-10
lines changed

5 files changed

+47
-10
lines changed

examples/java/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@
4646
<artifactId>maven-compiler-plugin</artifactId>
4747
</plugin>
4848

49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-surefire-plugin</artifactId>
52+
<configuration>
53+
<systemPropertyVariables>
54+
<beamTestPipelineOptions>
55+
</beamTestPipelineOptions>
56+
</systemPropertyVariables>
57+
</configuration>
58+
</plugin>
59+
4960
<plugin>
5061
<groupId>org.apache.maven.plugins</groupId>
5162
<artifactId>maven-dependency-plugin</artifactId>

runners/direct-java/pom.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,26 @@
8181
<groupId>org.apache.maven.plugins</groupId>
8282
<artifactId>maven-surefire-plugin</artifactId>
8383
<executions>
84-
<!-- For now, disables integration tests from the SDK as the runner is not ready. -->
8584
<execution>
8685
<id>runnable-on-service-tests</id>
86+
<phase>integration-test</phase>
87+
<goals>
88+
<goal>test</goal>
89+
</goals>
8790
<configuration>
88-
<skip>true</skip>
91+
<groups>org.apache.beam.sdk.testing.RunnableOnService</groups>
92+
<parallel>none</parallel>
93+
<failIfNoTests>true</failIfNoTests>
94+
<dependenciesToScan>
95+
<dependency>org.apache.beam:java-sdk-all</dependency>
96+
</dependenciesToScan>
97+
<systemPropertyVariables>
98+
<beamTestPipelineOptions>
99+
[
100+
"--runner=org.apache.beam.runners.direct.InProcessPipelineRunner"
101+
]
102+
</beamTestPipelineOptions>
103+
</systemPropertyVariables>
89104
</configuration>
90105
</execution>
91106
</executions>

runners/direct-java/src/main/java/org/apache/beam/runners/direct/CachedThreadPoolExecutorServiceFactory.java renamed to runners/direct-java/src/main/java/org/apache/beam/runners/direct/FixedThreadPoolExecutorServiceFactory.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@
2424
import java.util.concurrent.Executors;
2525

2626
/**
27-
* A {@link ExecutorServiceFactory} that produces cached thread pools via
28-
* {@link Executors#newCachedThreadPool()}.
27+
* A {@link ExecutorServiceFactory} that produces fixed thread pools via
28+
* {@link Executors#newFixedThreadPool(int)}, with the number of threads equal to the available
29+
* processors as provided by {@link Runtime#availableProcessors()}.
2930
*/
30-
class CachedThreadPoolExecutorServiceFactory
31+
class FixedThreadPoolExecutorServiceFactory
3132
implements DefaultValueFactory<ExecutorServiceFactory>, ExecutorServiceFactory {
32-
private static final CachedThreadPoolExecutorServiceFactory INSTANCE =
33-
new CachedThreadPoolExecutorServiceFactory();
33+
private static final FixedThreadPoolExecutorServiceFactory INSTANCE =
34+
new FixedThreadPoolExecutorServiceFactory();
3435

3536
@Override
3637
public ExecutorServiceFactory create(PipelineOptions options) {
@@ -39,6 +40,6 @@ public ExecutorServiceFactory create(PipelineOptions options) {
3940

4041
@Override
4142
public ExecutorService create() {
42-
return Executors.newCachedThreadPool();
43+
return Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
4344
}
4445
}

runners/direct-java/src/main/java/org/apache/beam/runners/direct/InProcessPipelineOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ public interface InProcessPipelineOptions extends PipelineOptions, ApplicationNa
4343
* it cannot enter a state in which it will not schedule additional pending work unless currently
4444
* scheduled work completes, as this may cause the {@link Pipeline} to cease processing.
4545
*
46-
* <p>Defaults to a {@link CachedThreadPoolExecutorServiceFactory}, which produces instances of
46+
* <p>Defaults to a {@link FixedThreadPoolExecutorServiceFactory}, which produces instances of
4747
* {@link Executors#newCachedThreadPool()}.
4848
*/
4949
@JsonIgnore
5050
@Required
5151
@Hidden
52-
@Default.InstanceFactory(CachedThreadPoolExecutorServiceFactory.class)
52+
@Default.InstanceFactory(FixedThreadPoolExecutorServiceFactory.class)
5353
ExecutorServiceFactory getExecutorServiceFactory();
5454

5555
void setExecutorServiceFactory(ExecutorServiceFactory executorService);

sdks/java/core/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,16 @@
124124
<artifactId>maven-compiler-plugin</artifactId>
125125
</plugin>
126126

127+
<plugin>
128+
<groupId>org.apache.maven.plugins</groupId>
129+
<artifactId>maven-surefire-plugin</artifactId>
130+
<configuration>
131+
<excludedGroups>
132+
org.apache.beam.sdk.testing.RunnableOnService
133+
</excludedGroups>
134+
</configuration>
135+
</plugin>
136+
127137
<plugin>
128138
<groupId>org.apache.maven.plugins</groupId>
129139
<artifactId>maven-dependency-plugin</artifactId>

0 commit comments

Comments
 (0)