org.apache.http.concurrent.FutureCallback Java Examples
The following examples show how to use
org.apache.http.concurrent.FutureCallback.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CreateTunnelLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(CreateTunnelRequest req, FutureCallback<CreateTunnelResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); TunnelServiceApi.CreateTunnelResponse defaultResponse = TunnelServiceApi.CreateTunnelResponse.getDefaultInstance(); asyncInvokePost( uri, null, TunnelProtocolBuilder.buildCreateTunnelRequest(req), tracer, new CreateTunnelResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #2
Source File: AsyncServiceClient.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
public <Res> void asyncSendRequest( RequestMessage request, ExecutionContext context, ResponseConsumer<Res> consumer, FutureCallback<Res> callback, TraceLogger traceLogger) { Preconditions.checkNotNull(request); Preconditions.checkNotNull(context); addExtraHeaders(request); context.getSigner().sign(request); handleRequest(request, context.getResquestHandlers()); consumer.setContext(context); final HttpHost target = request.getActionUri().getHost(); if (LOG.isDebugEnabled()) { LOG.debug(TRACE_ID_WITH_COLON + traceLogger.getTraceId() + DELIMITER + INTO_HTTP_ASYNC_CLIENT); } traceLogger.addEventTime(INTO_HTTP_ASYNC_CLIENT, System.currentTimeMillis()); httpClient.execute( new OTSRequestProducer(target, request.getRequest(), traceLogger), consumer, callback); }
Example #3
Source File: GetRowLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(GetRowRequest req, FutureCallback<GetRowResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.GetRowResponse defaultResponse = OtsInternalApi.GetRowResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildGetRowRequest(req), tracer, new GetRowResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #4
Source File: ListSearchIndexLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(ListSearchIndexRequest req, FutureCallback<ListSearchIndexResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); Search.ListSearchIndexResponse defaultResponse = Search.ListSearchIndexResponse.getDefaultInstance(); asyncInvokePost( uri, null, SearchProtocolBuilder.buildListSearchIndexRequest(req), tracer, new ListSearchIndexResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #5
Source File: ConnectTunnelLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(ConnectTunnelRequest req, FutureCallback<ConnectTunnelResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); TunnelServiceApi.ConnectResponse defaultResponse = TunnelServiceApi.ConnectResponse.getDefaultInstance(); asyncInvokePost( uri, null, TunnelProtocolBuilder.buildConnectTunnelRequest(req), tracer, new ConnectTunnelResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #6
Source File: ComputeSplitsBySizeLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(ComputeSplitsBySizeRequest request, FutureCallback<ComputeSplitsBySizeResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.ComputeSplitPointsBySizeResponse defaultResponse = OtsInternalApi.ComputeSplitPointsBySizeResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildComputeSplitsBySizeRequest(request), tracer, new ComputeSplitsBySizeResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #7
Source File: UpdateRowLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(UpdateRowRequest req, FutureCallback<UpdateRowResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.UpdateRowResponse defaultResponse = OtsInternalApi.UpdateRowResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildUpdateRowRequest(req), tracer, new UpdateRowResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #8
Source File: ListTableLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(ListTableRequest req, FutureCallback<ListTableResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.ListTableResponse defaultResponse = OtsInternalApi.ListTableResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildListTableRequest(), tracer, new ListTableResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #9
Source File: StartLocalTransactionLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(StartLocalTransactionRequest req, FutureCallback<StartLocalTransactionResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.StartLocalTransactionResponse defaultResponse = OtsInternalApi.StartLocalTransactionResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildStartLocalTransactionRequest(req), tracer, new StartLocalTransactionResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #10
Source File: CreateIndexLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(CreateIndexRequest req, FutureCallback<CreateIndexResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.CreateIndexResponse defaultResponse = OtsInternalApi.CreateIndexResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildCreateIndexRequest(req), tracer, new CreateIndexResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #11
Source File: GetShardIteratorLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(GetShardIteratorRequest req, FutureCallback<GetShardIteratorResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.GetShardIteratorResponse defaultResponse = OtsInternalApi.GetShardIteratorResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildGetShardIteratorRequest(req), tracer, new GetShardIteratorResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #12
Source File: SearchLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(SearchRequest req, FutureCallback<SearchResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); Search.SearchResponse defaultResponse = Search.SearchResponse.getDefaultInstance(); asyncInvokePost( uri, null, SearchProtocolBuilder.buildSearchRequest(req), tracer, new SearchResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #13
Source File: CreateSearchIndexLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(CreateSearchIndexRequest req, FutureCallback<CreateSearchIndexResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); Search.CreateSearchIndexResponse defaultResponse = Search.CreateSearchIndexResponse.getDefaultInstance(); asyncInvokePost( uri, null, SearchProtocolBuilder.buildCreateSearchIndexRequest(req), tracer, new CreateSearchIndexResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #14
Source File: DescribeSearchIndexLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(DescribeSearchIndexRequest req, FutureCallback<DescribeSearchIndexResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); Search.DescribeSearchIndexResponse defaultResponse = Search.DescribeSearchIndexResponse.getDefaultInstance(); asyncInvokePost( uri, null, SearchProtocolBuilder.buildDescribeSearchIndexRequest(req), tracer, new DescribeSearchIndexResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #15
Source File: HeartbeatLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(HeartbeatRequest req, FutureCallback<HeartbeatResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); TunnelServiceApi.HeartbeatResponse defaultResponse = TunnelServiceApi.HeartbeatResponse.getDefaultInstance(); asyncInvokePost( uri, null, TunnelProtocolBuilder.buildHeartbeatRequest(req), tracer, new HeartbeatResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #16
Source File: DescribeTableLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(DescribeTableRequest req, FutureCallback<DescribeTableResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.DescribeTableResponse defaultResponse = OtsInternalApi.DescribeTableResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildDescribeTableRequest(req), tracer, new DescribeTableResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #17
Source File: GetStreamRecordLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(GetStreamRecordRequest req, FutureCallback<GetStreamRecordResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.GetStreamRecordResponse defaultResponse = OtsInternalApi.GetStreamRecordResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildGetStreamRecordRequest(req), tracer, new GetStreamRecordResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #18
Source File: GetRangeLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(GetRangeRequest req, FutureCallback<GetRangeResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.GetRangeResponse defaultResponse = OtsInternalApi.GetRangeResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildGetRangeRequest(req), tracer, new GetRangeResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #19
Source File: CommitTransactionLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(CommitTransactionRequest req, FutureCallback<CommitTransactionResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.CommitTransactionResponse defaultResponse = OtsInternalApi.CommitTransactionResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildCommitTransactionRequest(req), tracer, new CommitTransactionResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #20
Source File: ListStreamLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(ListStreamRequest req, FutureCallback<ListStreamResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.ListStreamResponse defaultResponse = OtsInternalApi.ListStreamResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildListStreamRequest(req), tracer, new ListStreamResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #21
Source File: DeleteTunnelLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(DeleteTunnelRequest req, FutureCallback<DeleteTunnelResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); TunnelServiceApi.DeleteTunnelResponse defaultResponse = TunnelServiceApi.DeleteTunnelResponse.getDefaultInstance(); asyncInvokePost( uri, null, TunnelProtocolBuilder.buildDeleteTunnelRequest(req), tracer, new DeleteTunnelResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #22
Source File: AbortTransactionLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(AbortTransactionRequest req, FutureCallback<AbortTransactionResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.AbortTransactionResponse defaultResponse = OtsInternalApi.AbortTransactionResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildAbortTransactionRequest(req), tracer, new AbortTransactionResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #23
Source File: BatchGetRowLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(BatchGetRowRequest req, FutureCallback<BatchGetRowResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.BatchGetRowResponse defaultResponse = OtsInternalApi.BatchGetRowResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildBatchGetRowRequest(req.getCriteriasByTable()), tracer, new BatchGetRowResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #24
Source File: ListTunnelLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(ListTunnelRequest req, FutureCallback<ListTunnelResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); TunnelServiceApi.ListTunnelResponse defaultResponse = TunnelServiceApi.ListTunnelResponse.getDefaultInstance(); asyncInvokePost( uri, null, TunnelProtocolBuilder.buildListTunnelRequest(req), tracer, new ListTunnelResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #25
Source File: CheckpointLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(CheckpointRequest req, FutureCallback<CheckpointResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); TunnelServiceApi.CheckpointResponse defaultResponse = TunnelServiceApi.CheckpointResponse.getDefaultInstance(); asyncInvokePost( uri, null, TunnelProtocolBuilder.buildCheckpointRequest(req), tracer, new CheckpointResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #26
Source File: BatchWriteRowLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(BatchWriteRowRequest req, FutureCallback<BatchWriteRowResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.BatchWriteRowResponse defaultResponse = OtsInternalApi.BatchWriteRowResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildBatchWriteRowRequest(req), tracer, new BatchWriteRowResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #27
Source File: DeleteIndexLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(DeleteIndexRequest req, FutureCallback<DeleteIndexResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.DropIndexResponse defaultResponse = OtsInternalApi.DropIndexResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildDeleteIndexRequest(req), tracer, new DeleteIndexResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #28
Source File: DeleteRowLauncher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 6 votes |
@Override public void fire(DeleteRowRequest req, FutureCallback<DeleteRowResponse> cb) { LogUtil.logBeforeExecution(tracer, retry); OtsInternalApi.DeleteRowResponse defaultResponse = OtsInternalApi.DeleteRowResponse.getDefaultInstance(); asyncInvokePost( uri, null, OTSProtocolBuilder.buildDeleteRowRequest(req), tracer, new DeleteRowResponseConsumer( ResultParserFactory.createFactory().createProtocolBufferResultParser( defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), cb); }
Example #29
Source File: HttpClientTest.java From log4j2-elasticsearch with Apache License 2.0 | 6 votes |
@Test public void executeAsyncResponseIsNotPooledIfPoolNotConfigured() { // given HCHttp.Builder testObjectFactoryBuilder = HCHttpTest.createDefaultHttpObjectFactoryBuilder(); testObjectFactoryBuilder.withPooledResponseBuffers(false); HttpClient client = spy(testObjectFactoryBuilder.build().createClient()); CloseableHttpAsyncClient asyncClient = mockAsyncClient(client); BatchRequest request = createDefaultTestBatchRequest(); // when client.executeAsync(request, createMockTestResultHandler()); // then verify(client).getAsyncClient(); verify(asyncClient).execute( any(HttpAsyncRequestProducer.class), asyncConsumerCaptor.capture(), any(HttpContext.class), any(FutureCallback.class)); assertEquals(BasicAsyncResponseConsumer.class, asyncConsumerCaptor.getValue().getClass()); }
Example #30
Source File: HttpClient.java From log4j2-elasticsearch with Apache License 2.0 | 6 votes |
public <T extends Response> void executeAsync( final Request request, final ResponseHandler<T> responseHandler, final HttpClientContext httpClientContext ) { HttpUriRequest clientRequest; try { clientRequest = createClientRequest(request); } catch (IOException e) { responseHandler.failed(e); return; } FutureCallback<HttpResponse> responseCallback = createCallback(responseHandler); getAsyncClient().execute( HttpAsyncMethods.create(clientRequest), asyncResponseConsumerFactory.create(), httpClientContext, responseCallback); }