Java源码示例:org.elasticsearch.transport.FutureTransportResponseHandler

示例1
private Set<BytesArray> getExistingDigestsFromTarget(byte prefix) {
    BlobStartPrefixResponse response =
        (BlobStartPrefixResponse) transportService.submitRequest(
            request.targetNode(),
            BlobRecoveryTarget.Actions.START_PREFIX,
            new BlobStartPrefixSyncRequest(request.recoveryId(), request.shardId(), prefix),
            TransportRequestOptions.EMPTY,
            new FutureTransportResponseHandler<TransportResponse>() {

                @Override
                public TransportResponse read(StreamInput in) throws IOException {
                    return new BlobStartPrefixResponse(in);
                }
            }
        ).txGet();

    Set<BytesArray> result = new HashSet<>();
    for (byte[] digests : response.existingDigests) {
        result.add(new BytesArray(digests));
    }
    return result;
}