当前位置: 首页>>代码示例>>Java>>正文


Java HttpClientConfiguration类代码示例

本文整理汇总了Java中io.dropwizard.client.HttpClientConfiguration的典型用法代码示例。如果您正苦于以下问题:Java HttpClientConfiguration类的具体用法?Java HttpClientConfiguration怎么用?Java HttpClientConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HttpClientConfiguration类属于io.dropwizard.client包,在下文中一共展示了HttpClientConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BenchConfiguration

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
@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;
}
 
开发者ID:danburkert,项目名称:kudu-ts,代码行数:21,代码来源:BenchConfiguration.java

示例2: buildHttpClient

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
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;
}
 
开发者ID:soabase,项目名称:soabase,代码行数:26,代码来源:ClientBuilder.java

示例3: build

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
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;
}
 
开发者ID:ufried,项目名称:resilience-tutorial,代码行数:22,代码来源:AnalysisServiceFactory.java

示例4: create

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
@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
  );
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:35,代码来源:CassandraSchedulerConfiguration.java

示例5: CassandraSchedulerConfiguration

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
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;
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:30,代码来源:CassandraSchedulerConfiguration.java

示例6: configure

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
@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();
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:37,代码来源:TestModule.java

示例7: createDefaultJerseyClient

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
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);
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:8,代码来源:BlobStoreClientFactory.java

示例8: createDefaultJerseyClient

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
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);
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:8,代码来源:UserAccessControlClientFactory.java

示例9: createDefaultJerseyClient

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
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);
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:8,代码来源:QueueClientFactory.java

示例10: createDataStoreServiceFactory

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:12,代码来源:HadoopDataStoreManager.java

示例11: internalRun

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
@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);
}
 
开发者ID:soabase,项目名称:soabase,代码行数:11,代码来源:HelloApp.java

示例12: getHttpClientConfiguration

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
@JsonProperty("httpClient")
public HttpClientConfiguration getHttpClientConfiguration() {
    return httpClient;
}
 
开发者ID:kunai-consulting,项目名称:KeyStor,代码行数:5,代码来源:ConnectionServiceConfiguration.java

示例13: setHttpClientConfiguration

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
@JsonProperty("httpClient")
public void setHttpClientConfiguration(HttpClientConfiguration httpClient) {
    this.httpClient = httpClient;
}
 
开发者ID:kunai-consulting,项目名称:KeyStor,代码行数:5,代码来源:ConnectionServiceConfiguration.java

示例14: getHttpClientConfiguration

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
@JsonProperty("http_client")
public HttpClientConfiguration getHttpClientConfiguration() { return httpClientConfiguration; }
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:3,代码来源:CassandraSchedulerConfiguration.java

示例15: setHttpClientConfiguration

import io.dropwizard.client.HttpClientConfiguration; //导入依赖的package包/类
@JsonProperty("http_client")
public void setHttpClientConfiguration(HttpClientConfiguration httpClientConfiguration) {
  this.httpClientConfiguration = httpClientConfiguration;
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:5,代码来源:MutableSchedulerConfiguration.java


注:本文中的io.dropwizard.client.HttpClientConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。