當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。