クラス ChannelBuilderOptions

java.lang.ObjectSE
org.springframework.grpc.client.ChannelBuilderOptions

public final class ChannelBuilderOptions extends ObjectSE
GrpcChannelFactory がチャンネル構築時に使用するオプション。

ネイティブチャネルビルダー (例: shutdownGracePeriod) で利用できる機能を超える機能を提供し、ネイティブチャネルビルダーの動作 (例: interceptors) の一部をオーバーライドします。

作成者:
Chris Bono
  • 方法の詳細

    • interceptors

      public ListSE<io.grpc.ClientInterceptor> interceptors()
      クライアントインターセプターをチャネルに適用します。
      戻り値:
      チャネルに適用するクライアントインターセプター
    • mergeWithGlobalInterceptors

      public boolean mergeWithGlobalInterceptors()
      指定されたインターセプターをグローバルインターセプターとブレンドするかどうかを取得します。
      戻り値:
      提供されたインターセプターをグローバルインターセプターとブレンドするかどうか (デフォルトは false)
    • shutdownGracePeriod

      public DurationSE shutdownGracePeriod()
      チャネルが正常にシャットダウンするまで待機する時間を確保します。
      戻り値:
      チャンネルが正常にシャットダウンするまで待つ時間 (default of 30s)
    • customizer

      public <T extends io.grpc.ManagedChannelBuilder<T>> GrpcChannelBuilderCustomizer<T> customizer()
      チャンネルの作成に使用されたビルダーにカスタマイザーを適用します。
      型パラメーター:
      T - カスタマイザーが動作するビルダーの種類
      戻り値:
      適用するカスタマイザー (default of GrpcChannelBuilderCustomizer.defaults() )
    • defaults

      public static ChannelBuilderOptions defaults()
      デフォルト値が設定された、変更不可能な新しいオプションインスタンスを取得します。
      戻り値:
      a new immutable options instance populated with default values.
    • withInterceptors

      public ChannelBuilderOptions withInterceptors(ListSE<io.grpc.ClientInterceptor> interceptors)
      クライアントインターセプターをチャネルに適用するように設定します。
      パラメーター:
      interceptors - list of client interceptors to apply to the channel or empty list to clear out any previously set interceptors
      戻り値:
      a new immutable options instance populated with the specified interceptors and the settings of this current options instance.
    • withInterceptorsMerge

      public ChannelBuilderOptions withInterceptorsMerge(boolean mergeWithGlobalInterceptors)
      指定されたインターセプターをグローバルインターセプターとブレンドするかどうかを設定します。
      パラメーター:
      mergeWithGlobalInterceptors - whether the provided interceptors should be
      戻り値:
      a new immutable options instance populated with the specified merge setting and the settings of this current options instance.
    • withShutdownGracePeriod

      public ChannelBuilderOptions withShutdownGracePeriod(DurationSE shutdownGracePeriod)
      チャンネルが正常にシャットダウンするまでの待機時間を設定します。
      パラメーター:
      shutdownGracePeriod - チャンネルが正常にシャットダウンするまで待つ時間
      戻り値:
      a new immutable options instance populated with the specified shutdownGracePeriod and the settings of this current options instance.
    • withCustomizer

      public <T extends io.grpc.ManagedChannelBuilder<T>> ChannelBuilderOptions withCustomizer(GrpcChannelBuilderCustomizer<T> customizer)
      チャンネル作成に使用したビルダーにカスタマイザーを適用するように設定します。
      型パラメーター:
      T - type of builder the customizer operates on
      パラメーター:
      customizer - the customizer to apply to the builder used to create the channel
      戻り値:
      a new immutable options instance populated with the specified customizer and the settings of this current options instance.