Java 类com.amazonaws.client.builder.ExecutorFactory 实例源码

项目:circus-train    文件:CopyMapper.java   
/**
 * Implementation of the Mapper::setup() method. This extracts the S3MapReduceCp options specified in the Job's
 * configuration, to set up the Job.
 *
 * @param context Mapper's context.
 * @throws IOException On IO failure.
 * @throws InterruptedException If the job is interrupted.
 */
@Override
public void setup(Context context) throws IOException, InterruptedException {
  conf = new S3MapReduceCpConfiguration(context.getConfiguration());

  ignoreFailures = conf.getBoolean(ConfigurationVariable.IGNORE_FAILURES);

  targetFinalPath = new Path(conf.get(S3MapReduceCpConstants.CONF_LABEL_TARGET_FINAL_PATH));

  AwsS3ClientFactory awsS3ClientFactory = new AwsS3ClientFactory();
  transferManager = TransferManagerBuilder
      .standard()
      .withMinimumUploadPartSize(conf.getLong(ConfigurationVariable.MINIMUM_UPLOAD_PART_SIZE))
      .withMultipartUploadThreshold(conf.getLong(ConfigurationVariable.MULTIPART_UPLOAD_THRESHOLD))
      .withS3Client(awsS3ClientFactory.newInstance(conf))
      .withShutDownThreadPools(true)
      .withExecutorFactory(new ExecutorFactory() {
        @Override
        public ExecutorService newExecutor() {
          return Executors.newFixedThreadPool(conf.getInt(ConfigurationVariable.NUMBER_OF_UPLOAD_WORKERS));
        }
      })
      .build();
}
项目:spring-cloud-aws    文件:AmazonWebserviceClientFactoryBean.java   
@SuppressWarnings("unchecked")
@Override
protected T createInstance() throws Exception {

    String builderName = this.clientClass.getName() + "Builder";
    Class<?> className = ClassUtils.resolveClassName(builderName, ClassUtils.getDefaultClassLoader());

    Method method = ClassUtils.getStaticMethod(className, "standard");
    Assert.notNull(method, "Could not find standard() method in class:'" + className.getName() + "'");

    AwsClientBuilder<?, T> builder = (AwsClientBuilder<?, T>) ReflectionUtils.invokeMethod(method, null);

    if (this.executor != null) {
        AwsAsyncClientBuilder<?, T> asyncBuilder = (AwsAsyncClientBuilder<?, T>) builder;
        asyncBuilder.withExecutorFactory((ExecutorFactory) () -> this.executor);
    }

    if (this.credentialsProvider != null) {
        builder.withCredentials(this.credentialsProvider);
    }

    if (this.customRegion != null) {
        builder.withRegion(this.customRegion.getName());
    } else if (this.regionProvider != null) {
        builder.withRegion(this.regionProvider.getRegion().getName());
    } else {
        builder.withRegion(Regions.DEFAULT_REGION);
    }
    return builder.build();
}
项目:ibm-cos-sdk-java    文件:TransferManagerBuilder.java   
/**
 * @return The {@link ExecutorFactory} currently configured in the builder.
 */
public final ExecutorFactory getExecutorFactory() {
    return executorFactory;
}
项目:ibm-cos-sdk-java    文件:TransferManagerBuilder.java   
/**
 * Sets a new {@link ExecutorFactory} for the builder. The factory is invoked for each transfer
 * manager created through the builder.
 *
 * @param executorFactory New executor factory to use.
 */
public final void setExecutorFactory(ExecutorFactory executorFactory) {
    this.executorFactory = executorFactory;
}
项目:ibm-cos-sdk-java    文件:TransferManagerBuilder.java   
/**
 * Sets a new {@link ExecutorFactory} for the builder. The factory is invoked for each transfer
 * manager created through the builder.
 *
 * @param executorFactory New executor factory to use.
 * @return This object for method chaining.
 */
public final TransferManagerBuilder withExecutorFactory(ExecutorFactory executorFactory) {
    setExecutorFactory(executorFactory);
    return this;
}