Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kennknowles committed May 12, 2016
2 parents 2fbc0ea + e406949 commit d2ad0ed
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 10 deletions.
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

0 comments on commit d2ad0ed

Please sign in to comment.