本文整理汇总了Java中com.hubspot.horizon.HttpClient类的典型用法代码示例。如果您正苦于以下问题:Java HttpClient类的具体用法?Java HttpClient怎么用?Java HttpClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HttpClient类属于com.hubspot.horizon包,在下文中一共展示了HttpClient类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SingularityClient
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
public SingularityClient(String contextPath, HttpClient httpClient, Provider<List<String>> hostsProvider, Optional<SingularityClientCredentials> credentials, boolean ssl, int retryAttempts, Predicate<HttpResponse> retryStrategy) {
this.httpClient = httpClient;
this.contextPath = contextPath;
this.hostsProvider = hostsProvider;
this.random = new Random();
this.credentials = credentials;
this.ssl = ssl;
this.httpResponseRetryer = RetryerBuilder.<HttpResponse>newBuilder()
.withStopStrategy(StopStrategies.stopAfterAttempt(retryAttempts))
.withWaitStrategy(WaitStrategies.exponentialWait())
.retryIfResult(retryStrategy::test)
.retryIfException()
.build();
}
示例2: SingularityClient
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
public SingularityClient(String contextPath, HttpClient httpClient, Provider<List<String>> hostsProvider, Optional<SingularityClientCredentials> credentials) {
this.httpClient = httpClient;
this.contextPath = contextPath;
this.hostsProvider = hostsProvider;
this.random = new Random();
this.credentials = credentials;
}
示例3: configure
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Override
protected void configure() {
ObjectMapper objectMapper = JavaUtils.newObjectMapper();
HttpClient httpClient = new NingHttpClient(HttpConfig.newBuilder().setObjectMapper(objectMapper).build());
bind(HttpClient.class).annotatedWith(Names.named(HTTP_CLIENT_NAME)).toInstance(httpClient);
bind(SingularityClient.class).toProvider(SingularityClientProvider.class).in(Scopes.SINGLETON);
if (hosts != null) {
bindHosts(binder()).toInstance(hosts);
}
}
示例4: configure
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Override
protected void configure() {
ObjectMapper objectMapper = JavaUtils.newObjectMapper();
HttpConfig httpConfig = HttpConfig.newBuilder().setObjectMapper(objectMapper).build();
HttpClient httpClient = new NingHttpClient(httpConfig);
bind(ObjectMapper.class).annotatedWith(Names.named(MESOS_CLIENT_OBJECT_MAPPER)).toInstance(objectMapper);
bind(HttpClient.class).annotatedWith(Names.named(MesosClient.HTTP_CLIENT_NAME)).toInstance(httpClient);
}
示例5: configure
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Override
protected void configure() {
ObjectMapper objectMapper = JavaUtils.newObjectMapper();
HttpClient httpClient = new NingHttpClient(httpConfig.or(HttpConfig.newBuilder().setObjectMapper(objectMapper).build()));
bind(HttpClient.class).annotatedWith(Names.named(HTTP_CLIENT_NAME)).toInstance(httpClient);
bind(SingularityClient.class).toProvider(SingularityClientProvider.class).in(Scopes.SINGLETON);
if (hosts != null) {
bindHosts(binder()).toInstance(hosts);
}
}
示例6: configure
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Override
protected void configure() {
ObjectMapper objectMapper = JavaUtils.newObjectMapper();
HttpConfig httpConfig = HttpConfig.newBuilder().setObjectMapper(objectMapper).build();
HttpClient httpClient = new NingHttpClient(httpConfig);
bind(ObjectMapper.class).annotatedWith(Names.named(MESOS_CLIENT_OBJECT_MAPPER)).toInstance(objectMapper);
bind(HttpClient.class).annotatedWith(Names.named(SingularityMesosClient.HTTP_CLIENT_NAME)).toInstance(httpClient);
bind(MesosClient.class).to(SingularityMesosClient.class).in(Scopes.SINGLETON);
}
示例7: LifecycleHelper
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Inject
public LifecycleHelper(BaragonWorkerDatastore workerDatastore,
BaragonAuthDatastore authDatastore,
BaragonAgentConfiguration configuration,
BaragonAgentMetadata baragonAgentMetadata,
FilesystemConfigHelper configHelper,
BaragonStateDatastore stateDatastore,
ServerProvider serverProvider,
AtomicReference<BaragonAgentState> agentState,
@Named(BaragonAgentServiceModule.BARAGON_AGENT_HTTP_CLIENT) HttpClient httpClient,
@Named(BaragonAgentServiceModule.AGENT_SCHEDULED_EXECUTOR) ScheduledExecutorService executorService,
@Named(BaragonAgentServiceModule.AGENT_LEADER_LATCH) LeaderLatch leaderLatch,
@Named(BaragonAgentServiceModule.AGENT_LOCK) ReentrantLock agentLock,
@Named(BaragonAgentServiceModule.AGENT_LOCK_TIMEOUT_MS) long agentLockTimeoutMs) {
this.workerDatastore = workerDatastore;
this.authDatastore = authDatastore;
this.configuration = configuration;
this.baragonAgentMetadata = baragonAgentMetadata;
this.configHelper = configHelper;
this.stateDatastore = stateDatastore;
this.serverProvider = serverProvider;
this.agentState = agentState;
this.httpClient = httpClient;
this.executorService = executorService;
this.leaderLatch = leaderLatch;
this.agentLock = agentLock;
this.agentLockTimeoutMs = agentLockTimeoutMs;
}
示例8: providesApacheHttpClient
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Provides
@Singleton
@Named(BARAGON_AGENT_HTTP_CLIENT)
public HttpClient providesApacheHttpClient(HttpClientConfiguration config, ObjectMapper objectMapper) {
HttpConfig.Builder configBuilder = HttpConfig.newBuilder()
.setRequestTimeoutSeconds(config.getRequestTimeoutInMs() / 1000)
.setUserAgent(config.getUserAgent())
.setConnectTimeoutSeconds(config.getConnectionTimeoutInMs() / 1000)
.setFollowRedirects(true)
.setMaxRetries(config.getMaxRequestRetry())
.setObjectMapper(objectMapper);
return new ApacheHttpClient(configBuilder.build());
}
示例9: BaragonServiceClient
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
public BaragonServiceClient(String contextPath, HttpClient httpClient, Provider<List<String>> hostsProvider, Provider<Optional<String>> authkeyProvider) {
this.httpClient = httpClient;
this.contextPath = contextPath;
this.hostsProvider = hostsProvider;
this.authkeyProvider = authkeyProvider;
this.random = new Random();
}
示例10: configure
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Override
protected void configure() {
HttpClient httpClient = new NingHttpClient(HttpConfig.newBuilder()
.setObjectMapper(buildObjectMapper())
.build());
bind(HttpClient.class).annotatedWith(Names.named(HTTP_CLIENT_NAME)).toInstance(httpClient);
bind(BaragonServiceClient.class).toProvider(BaragonClientProvider.class).in(Scopes.SINGLETON);
if (hosts != null) {
bindHosts(binder()).toInstance(hosts);
}
}
示例11: SingularityClientProvider
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Inject
public SingularityClientProvider(@Named(SingularityClientModule.HTTP_CLIENT_NAME) HttpClient httpClient) {
this.httpClient = httpClient;
}
示例12: MesosClient
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Inject
public MesosClient(@Named(HTTP_CLIENT_NAME) HttpClient httpClient) {
this.httpClient = httpClient;
}
示例13: SingularityMesosClient
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Inject
public SingularityMesosClient(@Named(HTTP_CLIENT_NAME) HttpClient httpClient) {
this.httpClient = httpClient;
}
示例14: BaragonClientProvider
import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Inject
public BaragonClientProvider(@Named(BaragonClientModule.HTTP_CLIENT_NAME) HttpClient httpClient) {
this.httpClient = httpClient;
}