Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions examples/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@
<artifactId>maven-compiler-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<beamTestPipelineOptions>
</beamTestPipelineOptions>
</systemPropertyVariables>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down
19 changes: 17 additions & 2 deletions runners/direct-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,26 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<!-- For now, disables integration tests from the SDK as the runner is not ready. -->
<execution>
<id>runnable-on-service-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>true</skip>
<groups>org.apache.beam.sdk.testing.RunnableOnService</groups>
<parallel>none</parallel>
<failIfNoTests>true</failIfNoTests>
<dependenciesToScan>
<dependency>org.apache.beam:java-sdk-all</dependency>
</dependenciesToScan>
<systemPropertyVariables>
<beamTestPipelineOptions>
[
"--runner=org.apache.beam.runners.direct.InProcessPipelineRunner"
]
</beamTestPipelineOptions>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
import java.util.concurrent.Executors;

/**
* A {@link ExecutorServiceFactory} that produces cached thread pools via
* {@link Executors#newCachedThreadPool()}.
* A {@link ExecutorServiceFactory} that produces fixed thread pools via
* {@link Executors#newFixedThreadPool(int)}, with the number of threads equal to the available
* processors as provided by {@link Runtime#availableProcessors()}.
*/
class CachedThreadPoolExecutorServiceFactory
class FixedThreadPoolExecutorServiceFactory
implements DefaultValueFactory<ExecutorServiceFactory>, ExecutorServiceFactory {
private static final CachedThreadPoolExecutorServiceFactory INSTANCE =
new CachedThreadPoolExecutorServiceFactory();
private static final FixedThreadPoolExecutorServiceFactory INSTANCE =
new FixedThreadPoolExecutorServiceFactory();

@Override
public ExecutorServiceFactory create(PipelineOptions options) {
Expand All @@ -39,6 +40,6 @@ public ExecutorServiceFactory create(PipelineOptions options) {

@Override
public ExecutorService create() {
return Executors.newCachedThreadPool();
return Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
* <p>Defaults to a {@link CachedThreadPoolExecutorServiceFactory}, which produces instances of
* <p>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);
Expand Down
10 changes: 10 additions & 0 deletions sdks/java/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@
<artifactId>maven-compiler-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludedGroups>
org.apache.beam.sdk.testing.RunnableOnService
</excludedGroups>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down