Java 类io.dropwizard.client.HttpClientConfiguration 实例源码

项目:kudu-ts    文件:BenchConfiguration.java   
@JsonCreator
public BenchConfiguration(@JsonProperty("metrics") List<String> metrics,
                          @JsonProperty("tags") Map<String, List<String>> tags,
                          @JsonProperty("sampleFrequency") @DefaultValue("1.0") double sampleFrequency,
                          @JsonProperty("start") @DefaultValue("0") long start,
                          @JsonProperty("end") @DefaultValue("0") long end,
                          @JsonProperty("ktsdHost") @DefaultValue("localhost") String host,
                          @JsonProperty("ktsdPort") @DefaultValue("4242") int port,
                          @JsonProperty("sync") @DefaultValue("true") boolean sync,
                          @JsonProperty("httpClient") HttpClientConfiguration httpClient) {
  this.metrics = metrics;
  this.tags = tags;
  this.sampleFrequency = sampleFrequency;
  this.start = start;
  this.end = end;
  this.ktsdHost = host;
  this.ktsdPort = port;
  this.sync = sync;
  this.httpClient = httpClient;
}
项目:soabase    文件:ClientBuilder.java   
public HttpClient buildHttpClient(HttpClientConfiguration configuration, String clientName)
{
    Preconditions.checkState(providers.size() == 0, "HttpClient does not support providers");
    Preconditions.checkState(providerClasses.size() == 0, "HttpClient does not support providers");
    Preconditions.checkState(connectorProvider == null, "HttpClient does not support ConnectorProvider");

    HttpRequestRetryHandler nullRetry = new HttpRequestRetryHandler()
    {
        @Override
        public boolean retryRequest(IOException exception, int executionCount, HttpContext context)
        {
            return false;
        }
    };

    HttpClient httpClient = new HttpClientBuilder(environment)
        .using(configuration)
        .using(nullRetry)  // Apache's retry mechanism does not allow changing hosts. Do retries manually
        .build(clientName);
    HttpClient client = new WrappedHttpClient(httpClient, retryComponents);

    SoaBundle.getFeatures(environment).putNamed(client, HttpClient.class, clientName);

    return client;
}
项目:resilience-tutorial    文件:AnalysisServiceFactory.java   
public AnalysisServiceClient build(Environment environment) {
    final HttpClientConfiguration httpConfig = new HttpClientConfiguration();
    httpConfig.setTimeout(Duration.milliseconds(getTimeout()));
    final HttpClient httpClient = new HttpClientBuilder(environment).using(httpConfig)
            .build("analysis-http-client");

    AnalysisServiceClient client = new AnalysisServiceClientAdapter(getHost(), getPort(),
            getPortFailover(), getPath(), httpClient);

    environment.lifecycle().manage(new Managed() {
        @Override
        public void start() {
        }

        @Override
        public void stop() {
        }
    });

    return client;
}
项目:dcos-cassandra-service    文件:CassandraSchedulerConfiguration.java   
@JsonCreator
public static CassandraSchedulerConfiguration create(
  @JsonProperty("executor") final ExecutorConfig executorConfig,
  @JsonProperty("servers") final int servers,
  @JsonProperty("seeds") final int seeds,
  @JsonProperty("placement_constraint") final String placementConstraint,
  @JsonProperty("cassandra") final CassandraConfig cassandraConfig,
  @JsonProperty("cluster_task") final ClusterTaskConfig clusterTaskConfig,
  @JsonProperty("api_port") final int apiPort,
  @JsonProperty("service") final ServiceConfig serviceConfig,
  @JsonProperty("external_dc_sync_ms") final long externalDcSyncMs,
  @JsonProperty("external_dcs") final String externalDcs,
  @JsonProperty("dc_url") final String dcUrl,
  @JsonProperty("phase_strategy") final String phaseStrategy,
  @JsonProperty("enable_upgrade_sstable_endpoint") final boolean enableUpgradeSSTableEndpoint,
  @JsonProperty("http_client") final HttpClientConfiguration httpClientConfiguration) {

  return new CassandraSchedulerConfiguration(
    executorConfig,
    servers,
    seeds,
    placementConstraint,
    cassandraConfig,
    clusterTaskConfig,
    apiPort,
    serviceConfig,
    externalDcSyncMs,
    externalDcs,
    dcUrl,
    phaseStrategy,
    enableUpgradeSSTableEndpoint,
    httpClientConfiguration
  );
}
项目:dcos-cassandra-service    文件:CassandraSchedulerConfiguration.java   
private CassandraSchedulerConfiguration(
  ExecutorConfig executorConfig,
  int servers,
  int seeds,
  String placementConstraint,
  CassandraConfig cassandraConfig,
  ClusterTaskConfig clusterTaskConfig,
  int apiPort, ServiceConfig serviceConfig,
  long externalDcSyncMs,
  String externalDcs,
  String dcUrl,
  String phaseStrategy,
  boolean enableUpgradeSSTableEndpoint,
  HttpClientConfiguration httpClientConfiguration) {
  this.executorConfig = executorConfig;
  this.servers = servers;
  this.seeds = seeds;
  this.placementConstraint = placementConstraint;
  this.cassandraConfig = cassandraConfig;
  this.clusterTaskConfig = clusterTaskConfig;
  this.apiPort = apiPort;
  this.serviceConfig = serviceConfig;
  this.externalDcSyncMs = externalDcSyncMs;
  this.externalDcs = externalDcs;
  this.dcUrl = dcUrl;
  this.phaseStrategy = phaseStrategy;
  this.enableUpgradeSSTableEndpoint = enableUpgradeSSTableEndpoint;
  this.httpClientConfiguration = httpClientConfiguration;
}
项目:dcos-cassandra-service    文件:TestModule.java   
@Override
protected void configure() {
    bind(CassandraSchedulerConfiguration.class).toInstance(this.configuration);
    bind(new TypeLiteral<Serializer<Integer>>() {}).toInstance(IntegerStringSerializer.get());
    bind(new TypeLiteral<Serializer<Boolean>>() {}).toInstance(BooleanStringSerializer.get());
    bind(new TypeLiteral<Serializer<CassandraTask>>() {}).toInstance(CassandraTask.PROTO_SERIALIZER);
    bind(MesosConfig.class).toInstance(mesosConfig);

    bind(ServiceConfig.class)
            .annotatedWith(Names.named("ConfiguredIdentity"))
            .toInstance(configuration.getServiceConfig());
    bindConstant()
            .annotatedWith(Names.named("ConfiguredEnableUpgradeSSTableEndpoint"))
            .to(configuration.getEnableUpgradeSSTableEndpoint());

    HttpClientConfiguration httpClient = new HttpClientConfiguration();
    bind(HttpClient.class)
            .toInstance(new HttpClientBuilder(environment).using(httpClient).build("http-client-test"));
    bind(ExecutorService.class).toInstance(Executors.newCachedThreadPool());
    bind(CuratorFrameworkConfig.class).toInstance(curatorConfig);
    bind(ClusterTaskConfig.class).toInstance(configuration.getClusterTaskConfig());
    bind(ScheduledExecutorService.class).toInstance(Executors.newScheduledThreadPool(8));
    bind(SchedulerClient.class).asEagerSingleton();
    bind(IdentityManager.class).asEagerSingleton();
    bind(ConfigurationManager.class).asEagerSingleton();
    bind(PersistentOfferRequirementProvider.class);
    bind(CassandraState.class).asEagerSingleton();
    bind(EventBus.class).asEagerSingleton();
    bind(BackupManager.class).asEagerSingleton();
    bind(ClusterTaskOfferRequirementProvider.class);
    bind(Reconciler.class).to(DefaultReconciler.class).asEagerSingleton();
    bind(RestoreManager.class).asEagerSingleton();
    bind(CleanupManager.class).asEagerSingleton();
    bind(RepairManager.class).asEagerSingleton();
    bind(SeedsManager.class).asEagerSingleton();
}
项目:emodb    文件:BlobStoreClientFactory.java   
private static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration, MetricRegistry metricRegistry, String serviceName) {
    HttpClient httpClient = new HttpClientBuilder(metricRegistry).using(configuration).build(serviceName);
    ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
    ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
    config.getSingletons().add(new JacksonMessageBodyProvider(Jackson.newObjectMapper(), _validatorFactory.getValidator()));
    return new ApacheHttpClient4(handler, config);
}
项目:emodb    文件:PurgeDatabusEventsCommand.java   
private static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration, MetricRegistry metricRegistry, String serviceName) {
    HttpClient httpClient = new HttpClientBuilder(metricRegistry).using(configuration).build(serviceName);
    ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
    ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
    config.getSingletons().add(new JacksonMessageBodyProvider(Jackson.newObjectMapper(), _validatorFactory.getValidator()));
    return new ApacheHttpClient4(handler, config);
}
项目:emodb    文件:UserAccessControlClientFactory.java   
private static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration, String serviceName, MetricRegistry metricRegistry) {
    HttpClient httpClient = new HttpClientBuilder(metricRegistry).using(configuration).build(serviceName);
    ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
    ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
    config.getSingletons().add(new JacksonMessageBodyProvider(Jackson.newObjectMapper(), _validatorFactory.getValidator()));
    return new ApacheHttpClient4(handler, config);
}
项目:emodb    文件:DataStoreClientFactory.java   
private static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration, String serviceName, MetricRegistry metricRegistry) {
    HttpClient httpClient = new HttpClientBuilder(metricRegistry).using(configuration).build(serviceName);
    ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
    ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
    config.getSingletons().add(new JacksonMessageBodyProvider(Jackson.newObjectMapper(), _validatorFactory.getValidator()));
    return new ApacheHttpClient4(handler, config);
}
项目:emodb    文件:QueueClientFactory.java   
static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration, String serviceName, MetricRegistry metricRegistry) {
    HttpClient httpClient = new HttpClientBuilder(metricRegistry).using(configuration).build(serviceName);
    ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
    ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
    config.getSingletons().add(new JacksonMessageBodyProvider(Jackson.newObjectMapper(), _validatorFactory.getValidator()));
    return new ApacheHttpClient4(handler, config);
}
项目:emodb    文件:DedupQueueClientFactory.java   
static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration, String serviceName, MetricRegistry metricRegistry) {
    HttpClient httpClient = new HttpClientBuilder(metricRegistry).using(configuration).build(serviceName);
    ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
    ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
    config.getSingletons().add(new JacksonMessageBodyProvider(Jackson.newObjectMapper(), _validatorFactory.getValidator()));
    return new ApacheHttpClient4(handler, config);
}
项目:emodb    文件:HadoopDataStoreManager.java   
/**
 * Creates a ServiceFactory for a cluster with reasonable configurations.
 */
private MultiThreadedServiceFactory<AuthDataStore> createDataStoreServiceFactory(String cluster, MetricRegistry metricRegistry) {
    HttpClientConfiguration clientConfig = new HttpClientConfiguration();
    clientConfig.setKeepAlive(Duration.seconds(1));
    clientConfig.setConnectionTimeout(Duration.seconds(10));
    clientConfig.setTimeout(Duration.minutes(5));

    return DataStoreClientFactory.forClusterAndHttpConfiguration(cluster, clientConfig, metricRegistry);
}
项目:emodb    文件:DatabusClientFactory.java   
private static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration, MetricRegistry metricRegistry, String serviceName) {
    HttpClient httpClient = new HttpClientBuilder(metricRegistry).using(configuration).build(serviceName);
    ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
    ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
    config.getSingletons().add(new JacksonMessageBodyProvider(Jackson.newObjectMapper(), _validatorFactory.getValidator()));
    return new ApacheHttpClient4(handler, config);
}
项目:soabase    文件:HelloApp.java   
@Override
protected void internalRun(Configuration configuration, Environment environment)
{
    ClientBuilder builder = new ClientBuilder(environment);
    builder.buildJerseyClient(new JerseyClientConfiguration(), "jersey");
    builder.buildHttpClient(new HttpClientConfiguration(), "apache");

    environment.jersey().register(HelloResourceJersey.class);
    environment.jersey().register(HelloResourceApache.class);
}
项目:KeyStor    文件:ConnectionServiceConfiguration.java   
@JsonProperty("httpClient")
public HttpClientConfiguration getHttpClientConfiguration() {
    return httpClient;
}
项目:KeyStor    文件:ConnectionServiceConfiguration.java   
@JsonProperty("httpClient")
public void setHttpClientConfiguration(HttpClientConfiguration httpClient) {
    this.httpClient = httpClient;
}
项目:dcos-cassandra-service    文件:CassandraSchedulerConfiguration.java   
@JsonProperty("http_client")
public HttpClientConfiguration getHttpClientConfiguration() { return httpClientConfiguration; }
项目:dcos-cassandra-service    文件:MutableSchedulerConfiguration.java   
@JsonProperty("http_client")
public HttpClientConfiguration getHttpClientConfiguration() { return httpClientConfiguration; }
项目:dcos-cassandra-service    文件:MutableSchedulerConfiguration.java   
@JsonProperty("http_client")
public void setHttpClientConfiguration(HttpClientConfiguration httpClientConfiguration) {
  this.httpClientConfiguration = httpClientConfiguration;
}
项目:emodb    文件:BlobStoreClientFactory.java   
public static BlobStoreClientFactory forCluster(String clusterName, MetricRegistry metricRegistry) {
    HttpClientConfiguration httpClientConfiguration = new HttpClientConfiguration();
    httpClientConfiguration.setKeepAlive(Duration.seconds(1));
    return new BlobStoreClientFactory(clusterName, createDefaultJerseyClient(httpClientConfiguration, metricRegistry, getServiceName(clusterName)));
}
项目:emodb    文件:BlobStoreClientFactory.java   
public static BlobStoreClientFactory forClusterAndHttpConfiguration(String clusterName, HttpClientConfiguration configuration, MetricRegistry metricRegistry) {
    return new BlobStoreClientFactory(clusterName, createDefaultJerseyClient(configuration, metricRegistry, getServiceName(clusterName)));
}
项目:emodb    文件:UserAccessControlClientFactory.java   
public static UserAccessControlClientFactory forCluster(String clusterName, MetricRegistry metricRegistry) {
    HttpClientConfiguration httpClientConfiguration = new HttpClientConfiguration();
    httpClientConfiguration.setKeepAlive(Duration.seconds(1));
    return new UserAccessControlClientFactory(clusterName, createDefaultJerseyClient(httpClientConfiguration, getServiceName(clusterName), metricRegistry));
}
项目:emodb    文件:UserAccessControlClientFactory.java   
public static UserAccessControlClientFactory forClusterAndHttpConfiguration(String clusterName, HttpClientConfiguration configuration, MetricRegistry metricRegistry) {
    return new UserAccessControlClientFactory(clusterName, createDefaultJerseyClient(configuration, getServiceName(clusterName), metricRegistry));
}
项目:emodb    文件:DataStoreClientFactory.java   
public static DataStoreClientFactory forCluster(String clusterName, MetricRegistry metricRegistry) {
    HttpClientConfiguration httpClientConfiguration = new HttpClientConfiguration();
    httpClientConfiguration.setKeepAlive(Duration.seconds(1));
    return new DataStoreClientFactory(clusterName, createDefaultJerseyClient(httpClientConfiguration, getServiceName(clusterName), metricRegistry));
}
项目:emodb    文件:DataStoreClientFactory.java   
public static DataStoreClientFactory forClusterAndHttpConfiguration(String clusterName, HttpClientConfiguration configuration, MetricRegistry metricRegistry) {
    return new DataStoreClientFactory(clusterName, createDefaultJerseyClient(configuration, getServiceName(clusterName), metricRegistry));
}
项目:emodb    文件:QueueClientFactory.java   
public static QueueClientFactory forCluster(String clusterName, MetricRegistry metricRegistry) {
    HttpClientConfiguration httpClientConfiguration = new HttpClientConfiguration();
    httpClientConfiguration.setKeepAlive(Duration.seconds(1));
    return new QueueClientFactory(clusterName, createDefaultJerseyClient(httpClientConfiguration, getServiceName(clusterName), metricRegistry));
}
项目:emodb    文件:QueueClientFactory.java   
public static QueueClientFactory forClusterAndHttpConfiguration(String clusterName, HttpClientConfiguration configuration, MetricRegistry metricRegistry) {
    return new QueueClientFactory(clusterName, createDefaultJerseyClient(configuration, getServiceName(clusterName), metricRegistry));
}
项目:emodb    文件:DedupQueueClientFactory.java   
public static DedupQueueClientFactory forCluster(String clusterName, MetricRegistry metricRegistry) {
    HttpClientConfiguration httpClientConfiguration = new HttpClientConfiguration();
    httpClientConfiguration.setKeepAlive(Duration.seconds(1));
    return new DedupQueueClientFactory(clusterName, createDefaultJerseyClient(httpClientConfiguration, getServiceName(clusterName), metricRegistry));
}
项目:emodb    文件:DedupQueueClientFactory.java   
public static DedupQueueClientFactory forClusterAndHttpConfiguration(String clusterName, HttpClientConfiguration configuration, MetricRegistry metricRegistry) {
    return new DedupQueueClientFactory(clusterName, createDefaultJerseyClient(configuration, getServiceName(clusterName), metricRegistry));
}
项目:emodb    文件:DatabusClientFactory.java   
public static DatabusClientFactory forCluster(String clusterName, MetricRegistry metricRegistry) {
    HttpClientConfiguration httpClientConfiguration = new HttpClientConfiguration();
    httpClientConfiguration.setKeepAlive(Duration.seconds(1));
    return new DatabusClientFactory(clusterName, createDefaultJerseyClient(httpClientConfiguration, metricRegistry, getServiceName(clusterName)));
}
项目:emodb    文件:DatabusClientFactory.java   
public static DatabusClientFactory forClusterAndHttpConfiguration(String clusterName, HttpClientConfiguration configuration, MetricRegistry metricRegistry) {
    return new DatabusClientFactory(clusterName, createDefaultJerseyClient(configuration, metricRegistry, getServiceName(clusterName)));
}
项目:kudu-ts    文件:BenchConfiguration.java   
@JsonProperty
public HttpClientConfiguration getHttpClient() {
  return httpClient;
}
项目:hesperides    文件:HesperidesConfiguration.java   
public HttpClientConfiguration getHttpClientConfiguration() {
    return httpClientConfiguration;
}
项目:Pinot    文件:ThirdEyeDashboardConfiguration.java   
public HttpClientConfiguration getHttpClient() {
  return httpClient;
}
项目:DJBot    文件:DjConfiguration.java   
public HttpClientConfiguration getHttpClientConfiguration() {
    return httpClient;
}
项目:timbuctoo    文件:TimbuctooConfiguration.java   
@JsonProperty("httpClient")
@Valid
@Value.Default
public HttpClientConfiguration getHttpClientConfiguration() {
  return new HttpClientConfiguration();
}