本文整理汇总了Java中io.airlift.http.client.HttpClient类的典型用法代码示例。如果您正苦于以下问题:Java HttpClient类的具体用法?Java HttpClient怎么用?Java HttpClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HttpClient类属于io.airlift.http.client包,在下文中一共展示了HttpClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModule
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
@Override
public Module getModule(Configuration configuration)
{
return new PrivateModule()
{
@Override
protected void configure()
{
bind(ObjectMapper.class).toProvider(ObjectMapperProvider.class);
bind(HttpClient.class).toInstance(new JettyHttpClient());
}
@Inject
@Provides
@Exposed
@Singleton
QueryStatsClient getQueryStatsClient(HttpClient httpClient, ObjectMapper objectMapper, @Named("presto_rest.base_uri") String prestoRestInterfaceBaseUri)
{
return new HttpQueryStatsClient(httpClient, objectMapper, URI.create(prestoRestInterfaceBaseUri));
}
};
}
示例2: ClusterMemoryManager
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
@Inject
public ClusterMemoryManager(
@ForMemoryManager HttpClient httpClient,
NodeManager nodeManager,
LocationFactory locationFactory,
MBeanExporter exporter,
JsonCodec<MemoryInfo> memoryInfoCodec,
JsonCodec<MemoryPoolAssignmentsRequest> assignmentsRequestJsonCodec,
QueryIdGenerator queryIdGenerator,
ServerConfig serverConfig,
MemoryManagerConfig config)
{
requireNonNull(config, "config is null");
this.nodeManager = requireNonNull(nodeManager, "nodeManager is null");
this.locationFactory = requireNonNull(locationFactory, "locationFactory is null");
this.httpClient = requireNonNull(httpClient, "httpClient is null");
this.exporter = requireNonNull(exporter, "exporter is null");
this.memoryInfoCodec = requireNonNull(memoryInfoCodec, "memoryInfoCodec is null");
this.assignmentsRequestJsonCodec = requireNonNull(assignmentsRequestJsonCodec, "assignmentsRequestJsonCodec is null");
this.maxQueryMemory = config.getMaxQueryMemory();
this.coordinatorId = queryIdGenerator.getCoordinatorId();
this.enabled = serverConfig.isCoordinator();
this.killOnOutOfMemoryDelay = config.getKillOnOutOfMemoryDelay();
this.killOnOutOfMemory = config.isKillOnOutOfMemory();
}
示例3: HttpPageBufferClient
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
public HttpPageBufferClient(
HttpClient httpClient,
DataSize maxResponseSize,
Duration minErrorDuration,
URI location,
ClientCallback clientCallback,
BlockEncodingSerde blockEncodingSerde,
ScheduledExecutorService executor,
Stopwatch errorStopwatch)
{
this.httpClient = requireNonNull(httpClient, "httpClient is null");
this.maxResponseSize = requireNonNull(maxResponseSize, "maxResponseSize is null");
this.minErrorDuration = requireNonNull(minErrorDuration, "minErrorDuration is null");
this.location = requireNonNull(location, "location is null");
this.clientCallback = requireNonNull(clientCallback, "clientCallback is null");
this.blockEncodingSerde = requireNonNull(blockEncodingSerde, "blockEncodingManager is null");
this.executor = requireNonNull(executor, "executor is null");
this.errorStopwatch = requireNonNull(errorStopwatch, "errorStopwatch is null").reset();
}
示例4: ExchangeClient
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
public ExchangeClient(
BlockEncodingSerde blockEncodingSerde,
DataSize maxBufferedBytes,
DataSize maxResponseSize,
int concurrentRequestMultiplier,
Duration minErrorDuration,
HttpClient httpClient,
ScheduledExecutorService executor,
SystemMemoryUsageListener systemMemoryUsageListener)
{
this.blockEncodingSerde = blockEncodingSerde;
this.maxBufferedBytes = maxBufferedBytes.toBytes();
this.maxResponseSize = maxResponseSize;
this.concurrentRequestMultiplier = concurrentRequestMultiplier;
this.minErrorDuration = minErrorDuration;
this.httpClient = httpClient;
this.executor = executor;
this.systemMemoryUsageListener = systemMemoryUsageListener;
}
示例5: DiscoveryNodeManager
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
@Inject
public DiscoveryNodeManager(
@ServiceType("presto") ServiceSelector serviceSelector,
NodeInfo nodeInfo,
FailureDetector failureDetector,
NodeVersion expectedNodeVersion,
@ForGracefulShutdown HttpClient httpClient)
{
this.serviceSelector = requireNonNull(serviceSelector, "serviceSelector is null");
this.nodeInfo = requireNonNull(nodeInfo, "nodeInfo is null");
this.failureDetector = requireNonNull(failureDetector, "failureDetector is null");
this.expectedNodeVersion = requireNonNull(expectedNodeVersion, "expectedNodeVersion is null");
this.httpClient = requireNonNull(httpClient, "httpClient is null");
this.nodeStateUpdateExecutor = newSingleThreadScheduledExecutor(threadsNamed("node-state-poller-%s"));
this.currentNode = refreshNodesInternal();
}
示例6: ExecuteResource
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
@Inject
public ExecuteResource(
HttpServerInfo serverInfo,
AccessControl accessControl,
SessionPropertyManager sessionPropertyManager,
@ForExecute HttpClient httpClient,
QueryIdGenerator queryIdGenerator,
JsonCodec<QueryResults> queryResultsCodec)
{
this.serverInfo = requireNonNull(serverInfo, "serverInfo is null");
this.accessControl = requireNonNull(accessControl, "accessControl is null");
this.sessionPropertyManager = requireNonNull(sessionPropertyManager, "sessionPropertyManager is null");
this.httpClient = requireNonNull(httpClient, "httpClient is null");
this.queryIdGenerator = requireNonNull(queryIdGenerator, "queryIdGenerator is null");
this.queryResultsCodec = requireNonNull(queryResultsCodec, "queryResultsCodec is null");
}
示例7: HttpRemoteTaskFactory
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
@Inject
public HttpRemoteTaskFactory(QueryManagerConfig config,
TaskManagerConfig taskConfig,
@ForScheduler HttpClient httpClient,
LocationFactory locationFactory,
JsonCodec<TaskInfo> taskInfoCodec,
JsonCodec<TaskUpdateRequest> taskUpdateRequestCodec)
{
this.httpClient = httpClient;
this.locationFactory = locationFactory;
this.taskInfoCodec = taskInfoCodec;
this.taskUpdateRequestCodec = taskUpdateRequestCodec;
this.minErrorDuration = config.getRemoteTaskMinErrorDuration();
this.taskInfoRefreshMaxWait = taskConfig.getInfoRefreshMaxWait();
this.coreExecutor = newCachedThreadPool(daemonThreadsNamed("remote-task-callback-%s"));
this.executor = new BoundedExecutor(coreExecutor, config.getRemoteTaskMaxCallbackThreads());
this.executorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) coreExecutor);
this.errorScheduledExecutor = newSingleThreadScheduledExecutor(daemonThreadsNamed("remote-task-error-delay-%s"));
}
示例8: HeartbeatFailureDetector
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
@Inject
public HeartbeatFailureDetector(
@ServiceType("presto") ServiceSelector selector,
@ForFailureDetector HttpClient httpClient,
FailureDetectorConfig config,
NodeInfo nodeInfo)
{
requireNonNull(selector, "selector is null");
requireNonNull(httpClient, "httpClient is null");
requireNonNull(nodeInfo, "nodeInfo is null");
requireNonNull(config, "config is null");
checkArgument(config.getHeartbeatInterval().toMillis() >= 1, "heartbeat interval must be >= 1ms");
this.selector = selector;
this.httpClient = httpClient;
this.nodeInfo = nodeInfo;
this.failureRatioThreshold = config.getFailureRatioThreshold();
this.heartbeat = config.getHeartbeatInterval();
this.warmupInterval = config.getWarmupInterval();
this.gcGraceInterval = config.getExpirationGraceInterval();
this.isEnabled = config.isEnabled();
}
示例9: StatementClient
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
public StatementClient(HttpClient httpClient, JsonCodec<QueryResults> queryResultsCodec, ClientSession session, String query)
{
requireNonNull(httpClient, "httpClient is null");
requireNonNull(queryResultsCodec, "queryResultsCodec is null");
requireNonNull(session, "session is null");
requireNonNull(query, "query is null");
this.httpClient = httpClient;
this.responseHandler = createFullJsonResponseHandler(queryResultsCodec);
this.debug = session.isDebug();
this.timeZoneId = session.getTimeZoneId();
this.query = query;
this.requestTimeoutNanos = session.getClientRequestTimeout().roundTo(NANOSECONDS);
Request request = buildQueryRequest(session, query);
JsonResponse<QueryResults> response = httpClient.execute(request, responseHandler);
if (response.getStatusCode() != HttpStatus.OK.code() || !response.hasValue()) {
throw requestFailedException("starting query", request, response);
}
processResponse(response);
}
示例10: RemoteNodeMemory
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
public RemoteNodeMemory(HttpClient httpClient, JsonCodec<MemoryInfo> memoryInfoCodec, JsonCodec<MemoryPoolAssignmentsRequest> assignmentsRequestJsonCodec, URI memoryInfoUri)
{
this.httpClient = requireNonNull(httpClient, "httpClient is null");
this.memoryInfoUri = requireNonNull(memoryInfoUri, "memoryInfoUri is null");
this.memoryInfoCodec = requireNonNull(memoryInfoCodec, "memoryInfoCodec is null");
this.assignmentsRequestJsonCodec = requireNonNull(assignmentsRequestJsonCodec, "assignmentsRequestJsonCodec is null");
}
示例11: ExchangeClientFactory
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
@Inject
public ExchangeClientFactory(BlockEncodingSerde blockEncodingSerde,
ExchangeClientConfig config,
@ForExchange HttpClient httpClient,
@ForExchange ScheduledExecutorService executor)
{
this(blockEncodingSerde,
config.getMaxBufferSize(),
config.getMaxResponseSize(),
config.getConcurrentRequestMultiplier(),
config.getMinErrorDuration(),
httpClient,
executor);
}
示例12: PrestoEventStream
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
@Inject
public PrestoEventStream(@ForStreamer HttpClient httpClient, AWSKinesisModule.PrestoStreamConfig config, PrestoConfig prestoConfig) {
this.httpClient = httpClient;
this.streamingPort = config.getPort();
this.prestoAddress = prestoConfig.getAddress();
this.queryCodec = JsonCodec.jsonCodec(StreamQuery.class);
}
示例13: HttpQueryStatsClient
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
public HttpQueryStatsClient(HttpClient httpClient, ObjectMapper objectMapper, URI baseUri)
{
this.httpClient = httpClient;
this.objectMapper = objectMapper;
this.baseUri = baseUri;
}
示例14: RemoteNodeState
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
public RemoteNodeState(HttpClient httpClient, URI stateInfoUri)
{
this.httpClient = requireNonNull(httpClient, "httpClient is null");
this.stateInfoUri = requireNonNull(stateInfoUri, "stateInfoUri is null");
}
示例15: HttpRemoteTask
import io.airlift.http.client.HttpClient; //导入依赖的package包/类
public HttpRemoteTask(Session session,
TaskId taskId,
String nodeId,
int partition,
URI location,
PlanFragment planFragment,
Multimap<PlanNodeId, Split> initialSplits,
OutputBuffers outputBuffers,
HttpClient httpClient,
Executor executor,
ScheduledExecutorService errorScheduledExecutor,
Duration minErrorDuration,
Duration refreshMaxWait,
JsonCodec<TaskInfo> taskInfoCodec,
JsonCodec<TaskUpdateRequest> taskUpdateRequestCodec,
PartitionedSplitCountTracker partitionedSplitCountTracker)
{
requireNonNull(session, "session is null");
requireNonNull(taskId, "taskId is null");
requireNonNull(nodeId, "nodeId is null");
requireNonNull(location, "location is null");
checkArgument(partition >= 0, "partition is negative");
requireNonNull(planFragment, "planFragment1 is null");
requireNonNull(outputBuffers, "outputBuffers is null");
requireNonNull(httpClient, "httpClient is null");
requireNonNull(executor, "executor is null");
requireNonNull(taskInfoCodec, "taskInfoCodec is null");
requireNonNull(taskUpdateRequestCodec, "taskUpdateRequestCodec is null");
requireNonNull(partitionedSplitCountTracker, "partitionedSplitCountTracker is null");
try (SetThreadName ignored = new SetThreadName("HttpRemoteTask-%s", taskId)) {
this.taskId = taskId;
this.session = session;
this.nodeId = nodeId;
this.partition = partition;
this.planFragment = planFragment;
this.outputBuffers.set(outputBuffers);
this.httpClient = httpClient;
this.executor = executor;
this.errorScheduledExecutor = errorScheduledExecutor;
this.taskInfoCodec = taskInfoCodec;
this.taskUpdateRequestCodec = taskUpdateRequestCodec;
this.updateErrorTracker = new RequestErrorTracker(taskId, location, minErrorDuration, errorScheduledExecutor, "updating task");
this.getErrorTracker = new RequestErrorTracker(taskId, location, minErrorDuration, errorScheduledExecutor, "getting info for task");
this.partitionedSplitCountTracker = requireNonNull(partitionedSplitCountTracker, "partitionedSplitCountTracker is null");
for (Entry<PlanNodeId, Split> entry : requireNonNull(initialSplits, "initialSplits is null").entries()) {
ScheduledSplit scheduledSplit = new ScheduledSplit(nextSplitId.getAndIncrement(), entry.getValue());
pendingSplits.put(entry.getKey(), scheduledSplit);
}
if (initialSplits.containsKey(planFragment.getPartitionedSource())) {
pendingSourceSplitCount = initialSplits.get(planFragment.getPartitionedSource()).size();
}
List<BufferInfo> bufferStates = outputBuffers.getBuffers()
.keySet().stream()
.map(outputId -> new BufferInfo(outputId, false, 0, 0, PageBufferInfo.empty()))
.collect(toImmutableList());
TaskStats taskStats = new TaskStats(DateTime.now(), null);
taskInfo = new StateMachine<>("task " + taskId, executor, new TaskInfo(
taskId,
"",
TaskInfo.MIN_VERSION,
TaskState.PLANNED,
location,
DateTime.now(),
new SharedBufferInfo(BufferState.OPEN, true, true, 0, 0, 0, 0, bufferStates),
ImmutableSet.<PlanNodeId>of(),
taskStats,
ImmutableList.<ExecutionFailureInfo>of()));
long timeout = minErrorDuration.toMillis() / 3;
requestTimeout = new Duration(timeout + refreshMaxWait.toMillis(), MILLISECONDS);
continuousTaskInfoFetcher = new ContinuousTaskInfoFetcher(refreshMaxWait);
partitionedSplitCountTracker.setPartitionedSplitCount(getPartitionedSplitCount());
}
}