Packages

final class MethodBuilder[Req, Rep] extends Parameterized[MethodBuilder[Req, Rep]]

Self Type
MethodBuilder[Req, Rep]
See also

methodBuilder methods on client protocols, such as Http.Client or ThriftMux.Client for an entry point.

user guide

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MethodBuilder
  2. Parameterized
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. def configured[P](psp: (P, Param[P])): MethodBuilder[Req, Rep]

    Java friendly API for configured.

    Java friendly API for configured.

    The Tuple2 can often be created by calls to a mk(): (P, Stack.Param[P]) method on parameters (see com.twitter.finagle.loadbalancer.LoadBalancerFactory.Param.mk() as an example).

    Definition Classes
    Parameterized
  7. def configured[P](p: P)(implicit sp: Param[P]): MethodBuilder[Req, Rep]

    Add the parameter, p, to the current Params.

    Add the parameter, p, to the current Params.

    Java users may find it easier to use the Tuple2 version below.

    Definition Classes
    Parameterized
  8. def configuredParams(newParams: Params): MethodBuilder[Req, Rep]

    Adds all parameters, newParams, to the current Params.

    Adds all parameters, newParams, to the current Params.

    Definition Classes
    Parameterized
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def idempotent(maxExtraLoad: Tunable[Double], sendInterrupts: Boolean, classifier: ResponseClassifier): MethodBuilder[Req, Rep]

    Configure that requests are to be treated as idempotent.

    Configure that requests are to be treated as idempotent. Because requests can be safely retried, BackupRequestFilter is configured with the params maxExtraLoad and sendInterrupts to decrease tail latency by sending an additional fraction of requests.

    maxExtraLoad

    How much extra load, as a fraction, we are willing to send to the server. Must be between 0.0 and 1.0.

    sendInterrupts

    Whether or not to interrupt the original or backup request when a response is returned and the result of the outstanding request is superseded. For protocols without a control plane, where the connection is cut on interrupts, this should be "false" to avoid connection churn.

    classifier

    ResponseClassifier (combined (via ResponseClassifier.orElse) with any existing classifier in the stack params), used for determining whether or not requests have succeeded and should be retried. These determinations are also reflected in stats, and used by FailureAccrualFactory.

  15. def idempotent(maxExtraLoad: Tunable[Double], sendInterrupts: Boolean, minSendBackupAfterMs: Int, classifier: ResponseClassifier): MethodBuilder[Req, Rep]

    Configure that requests are to be treated as idempotent.

    Configure that requests are to be treated as idempotent. Because requests can be safely retried, BackupRequestFilter is configured with the params maxExtraLoad and sendInterrupts to decrease tail latency by sending an additional fraction of requests.

    If you are using TwitterServer, a good starting point for determining a value for maxExtraLoad is looking at the details of the PDF histogram for request latency, at /admin/histograms. If you choose a maxExtraLoad of 1.percent, for example, you can expect your p999/p9999 latencies to (roughly) now be that of your p99 latency. For 5.percent, those latencies would shift to your p95 latency. You should also ensure that your backend can tolerate the increased load.

    maxExtraLoad

    How much extra load, as a Tunable fraction, we are willing to send to the server. Must be between 0.0 and 1.0.

    sendInterrupts

    Whether or not to interrupt the original or backup request when a response is returned and the result of the outstanding request is superseded. For protocols without a control plane, where the connection is cut on interrupts, this should be "false" to avoid connection churn.

    minSendBackupAfterMs

    Use a minimum non-zero delay to prevent sending unnecessary backup requests immediately for services where the latency at the percentile where a backup will be sent is ~0ms.

    classifier

    ResponseClassifier (combined (via ResponseClassifier.orElse) with any existing classifier in the stack params), used for determining whether or not requests have succeeded and should be retried. These determinations are also reflected in stats, and used by FailureAccrualFactory.

  16. def idempotent(maxExtraLoad: Double, sendInterrupts: Boolean, classifier: ResponseClassifier): MethodBuilder[Req, Rep]

    Configure that requests are to be treated as idempotent.

    Configure that requests are to be treated as idempotent. Because requests can be safely retried, BackupRequestFilter is configured with the params maxExtraLoad and sendInterrupts to decrease tail latency by sending an additional fraction of requests.

    maxExtraLoad

    How much extra load, as a fraction, we are willing to send to the server. Must be between 0.0 and 1.0.

    sendInterrupts

    Whether or not to interrupt the original or backup request when a response is returned and the result of the outstanding request is superseded. For protocols without a control plane, where the connection is cut on interrupts, this should be "false" to avoid connection churn.

    classifier

    ResponseClassifier (combined (via ResponseClassifier.orElse) with any existing classifier in the stack params), used for determining whether or not requests have succeeded and should be retried. These determinations are also reflected in stats, and used by FailureAccrualFactory.

  17. def idempotent(maxExtraLoad: Double, sendInterrupts: Boolean, minSendBackupAfterMs: Int, classifier: ResponseClassifier): MethodBuilder[Req, Rep]

    Configure that requests are to be treated as idempotent.

    Configure that requests are to be treated as idempotent. Because requests can be safely retried, BackupRequestFilter is configured with the params maxExtraLoad and sendInterrupts to decrease tail latency by sending an additional fraction of requests.

    maxExtraLoad

    How much extra load, as a fraction, we are willing to send to the server. Must be between 0.0 and 1.0.

    sendInterrupts

    Whether or not to interrupt the original or backup request when a response is returned and the result of the outstanding request is superseded. For protocols without a control plane, where the connection is cut on interrupts, this should be "false" to avoid connection churn.

    minSendBackupAfterMs

    Use a minimum non-zero delay to prevent sending unnecessary backup requests immediately for services where the latency at the percentile where a backup will be sent is ~0ms.

    classifier

    ResponseClassifier (combined (via ResponseClassifier.orElse) with any existing classifier in the stack params), used for determining whether or not requests have succeeded and should be retried. These determinations are also reflected in stats, and used by FailureAccrualFactory.

    Note

    See idempotent below for a version that takes a Tunable[Double] for maxExtraLoad.

  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. val methodPool: MethodPool[Req, Rep]
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. def newService: Service[Req, Rep]

    Create a Service from the current configuration.

  22. def newService(methodName: String): Service[Req, Rep]

    Create a Service from the current configuration.

  23. def newServicePerEndpoint[ServicePerEndpoint <: Filterable[ServicePerEndpoint]](builder: ServicePerEndpointBuilder[Req, Rep, ServicePerEndpoint], methodName: String): ServicePerEndpoint

    Create a ServicePerEndpoint from the current configuration.

  24. def newServicePerEndpoint[ServicePerEndpoint <: Filterable[ServicePerEndpoint]](builder: ServicePerEndpointBuilder[Req, Rep, ServicePerEndpoint]): ServicePerEndpoint

    Create a ServicePerEndpoint from the current configuration.

  25. def nonIdempotent: MethodBuilder[Req, Rep]

    Configure that requests are to be treated as non-idempotent.

    Configure that requests are to be treated as non-idempotent. BackupRequestFilter is disabled, and only those failures that are known to be safe to retry (i.e., write failures, where the request was never sent) are retried via requeue filter; any previously configured retries are removed.

  26. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. val params: Params
    Definition Classes
    MethodBuilderParameterized
  29. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  30. def toString(): String
    Definition Classes
    MethodBuilder → AnyRef → Any
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  32. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  33. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  34. def withParams(ps: Params): MethodBuilder[Req, Rep]
    Definition Classes
    MethodBuilderParameterized
  35. def withRetry: MethodBuilderRetry[Req, Rep]

    Configure the application-level retry policy.

    Configure the application-level retry policy.

    Defaults to using the client's com.twitter.finagle.service.ResponseClassifier to retry failures marked as retryable.

    The classifier is also used to determine the logical success metrics of the client. Logical here means after any retries are run. For example should a request result in retryable failure on the first attempt, but succeed upon retry, this is exposed through metrics as a success.

    Example:
    1. Retrying on Exception responses:

      import com.twitter.finagle.client.MethodBuilder
      import com.twitter.finagle.service.{ReqRep, ResponseClass}
      import com.twitter.util.Throw
      
      val builder: MethodBuilder[Int, Int] = ???
      builder.withRetry.forClassifier {
        case ReqRep(_, Throw(_)) => ResponseClass.RetryableFailure
      }
    See also

    MethodBuilderRetry

  36. def withTimeout: MethodBuilderTimeout[Req, Rep]

    Configure the timeouts.

    Configure the timeouts.

    The per-request timeout defaults to using the client's configuration for com.twitter.finagle.service.TimeoutFilter.Param(timeout), which is typically set via com.twitter.finagle.param.CommonParams.withRequestTimeout.

    The total timeout defaults to using the client's configuration for com.twitter.finagle.service.TimeoutFilter.TotalTimeout(timeout).

    Examples:
    1. A total timeout of 200 milliseconds:

      import com.twitter.conversions.DurationOps._
      import com.twitter.finagle.client.MethodBuilder
      
      val builder: MethodBuilder[Int, Int] = ???
      builder.withTimeout.total(200.milliseconds)
    2. ,
    3. A per-request timeout of 50 milliseconds:

      import com.twitter.conversions.DurationOps._
      import com.twitter.finagle.client.MethodBuilder
      
      val builder: MethodBuilder[Int, Int] = ???
      builder.withTimeout.perRequest(50.milliseconds)
    See also

    MethodBuilderTimeout

  37. def withTraceInitializer(initializer: TypeAgnostic): MethodBuilder[Req, Rep]

    Allow customizations for protocol-specific trace initialization.

Inherited from Parameterized[MethodBuilder[Req, Rep]]

Inherited from AnyRef

Inherited from Any

Ungrouped