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


Java Metadata.Headers方法代码示例

本文整理汇总了Java中io.grpc.Metadata.Headers方法的典型用法代码示例。如果您正苦于以下问题:Java Metadata.Headers方法的具体用法?Java Metadata.Headers怎么用?Java Metadata.Headers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.grpc.Metadata的用法示例。


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

示例1: retryCall

import io.grpc.Metadata; //导入方法依赖的package包/类
private void retryCall(
    RequestT payload,
    Metadata.Headers requestHeaders,
    Listener<ResponseT> listener) {
  final Call<RequestT, ResponseT> delegate = channel.newCall(method);
  delegate.start(listener, requestHeaders);
  delegate.request(1);
  cancelled.addListener(new Runnable() {
    @Override
    public void run() {
      delegate.cancel();
    }
  }, MoreExecutors.directExecutor());

  delegate.sendPayload(payload);
  delegate.halfClose();
}
 
开发者ID:dmmcerlean,项目名称:cloud-bigtable-client,代码行数:18,代码来源:RetryingCall.java

示例2: start

import io.grpc.Metadata; //导入方法依赖的package包/类
@Override
public void start(Listener<ResponseT> listener, Metadata.Headers headers) {
  Preconditions.checkState(
      this.listener == null,
      "start should not be invoked more than once for unary calls.");
  this.listener = listener;
  this.headers = headers;
}
 
开发者ID:dmmcerlean,项目名称:cloud-bigtable-client,代码行数:9,代码来源:RetryingCall.java

示例3: RetryListener

import io.grpc.Metadata; //导入方法依赖的package包/类
public RetryListener(
    RetryingCall<RequestT, ResponseT> call,
    RequestT payload,
    Metadata.Headers requestHeaders,
    boolean isRetriableCall,
    Call.Listener<ResponseT> delegate) {
  this.retryingCall = call;
  this.delegate = delegate;
  this.payload = payload;
  this.requestHeaders = requestHeaders;
  this.isRetriableCall = isRetriableCall;
}
 
开发者ID:dmmcerlean,项目名称:cloud-bigtable-client,代码行数:13,代码来源:RetryListener.java

示例4: start

import io.grpc.Metadata; //导入方法依赖的package包/类
@Override
public void start(Listener<ResponseT> responseListener, Metadata.Headers headers) {
  Listener<ResponseT> forwardingListener = createGatheringListener(responseListener);
  super.start(forwardingListener, headers);
}
 
开发者ID:dmmcerlean,项目名称:cloud-bigtable-client,代码行数:6,代码来源:CallCompletionStatusInterceptor.java

示例5: wrapChannel

import io.grpc.Metadata; //导入方法依赖的package包/类
private static CloseableChannel wrapChannel(ChannelOptions channelOptions,
    ExecutorService executor, Channel channel, ClientCloseHandler onClientClose) {
  List<ClientInterceptor> interceptors = new ArrayList<>();
  if (channelOptions.getCredential() != null) {
    interceptors.add(new ClientAuthInterceptor(channelOptions.getCredential(), executor));
  }

  if (channelOptions.getAuthority() != null) {
    Metadata.Headers headers = new Metadata.Headers();
    headers.setAuthority(channelOptions.getAuthority());
    interceptors.add(MetadataUtils.newAttachHeadersInterceptor(headers));
  }

  CallCompletionStatusInterceptor preRetryCallStatusInterceptor = null;
  if (!Strings.isNullOrEmpty(channelOptions.getCallStatusReportPath())) {
    preRetryCallStatusInterceptor = new CallCompletionStatusInterceptor();
    interceptors.add(preRetryCallStatusInterceptor);
  }

  if (!interceptors.isEmpty()) {
    channel = ClientInterceptors.intercept(channel, interceptors);
    interceptors.clear();
  }

  if (channelOptions.getUnaryCallRetryOptions().enableRetries()) {
    ScheduledExecutorService scheduledRetries;
    if (channelOptions.getScheduledExecutorService() != null) {
      scheduledRetries = channelOptions.getScheduledExecutorService();
    } else {
      scheduledRetries = createScheduledRetryPool();

      onClientClose = createChainedCloseHandler(
          onClientClose, createExecutorCloseHandler(scheduledRetries));
    }

    RetryOptions unaryCallRetryOptions = channelOptions.getUnaryCallRetryOptions();
    channel = new UnaryCallRetryInterceptor(
        channel,
        scheduledRetries,
        METHODS_TO_RETRY_MAP,
        unaryCallRetryOptions.getInitialBackoffMillis(),
        unaryCallRetryOptions.getBackoffMultiplier(),
        unaryCallRetryOptions.getMaxElaspedBackoffMillis());
  }

  if (!Strings.isNullOrEmpty(channelOptions.getCallStatusReportPath())) {
    CallCompletionStatusInterceptor postRetryCallStatusInterceptor =
        new CallCompletionStatusInterceptor();

    registerCallStatusReportingShutdownHook(
        channelOptions.getCallStatusReportPath(),
        preRetryCallStatusInterceptor,
        postRetryCallStatusInterceptor);

    channel = ClientInterceptors.intercept(channel, postRetryCallStatusInterceptor);
  }

  return createCloseableChannel(channel, onClientClose);
}
 
开发者ID:dmmcerlean,项目名称:cloud-bigtable-client,代码行数:60,代码来源:BigtableChannels.java

示例6: onHeaders

import io.grpc.Metadata; //导入方法依赖的package包/类
@Override
public void onHeaders(Metadata.Headers headers) {
  stateSignalledToListener = true;
  delegate.onHeaders(headers);
}
 
开发者ID:dmmcerlean,项目名称:cloud-bigtable-client,代码行数:6,代码来源:RetryListener.java


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