Packages

final class MethodBuilder[Req, Rep] extends AnyRef

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. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. 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.

    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.

    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.

  12. 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.

    Note

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

  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. def newService: Service[Req, Rep]

    Create a Service from the current configuration.

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

    Create a Service from the current configuration.

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

    Create a ServicePerEndpoint from the current configuration.

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

    Create a ServicePerEndpoint from the current configuration.

  19. 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.

  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. def params: Params

    Returns the client stack parameters.

  23. val refCounted: RefcountedClosable[Service[Req, Rep]]
  24. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  29. 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

  30. 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

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

    Allow customizations for protocol-specific trace initialization.

Inherited from AnyRef

Inherited from Any

Ungrouped