Class TailCutLayer

java.lang.Object
org.apache.opendal.Layer
org.apache.opendal.layer.TailCutLayer

public class TailCutLayer extends Layer
Cancels slow calls using an adaptive deadline based on recent successful calls. Once enough samples are available, the layer multiplies the configured latency percentile by the safety factor and clamps the result to the configured deadline range. A cancelled call returns a temporary OpenDALException with code OpenDALException.Code.Unexpected.

Each call to AsyncOperator.layer(Layer) with this layer creates an independent latency history. Use AsyncOperator.duplicate() on the returned handle to share latency statistics across handles. Add this layer before RetryLayer so retries can handle cancellations.

See Also:
  • Constructor Details

    • TailCutLayer

      public TailCutLayer()
      Creates a layer with percentile 95, a safety factor of 1.3, a 60-second window, 200 minimum samples, and deadlines between 500 milliseconds and 30 seconds.
  • Method Details

    • builder

      public static TailCutLayer.TailCutLayerBuilder builder()
      Returns a builder initialized with the default settings.
      Returns:
      a new builder
    • layer

      protected long layer(long nativeOp)
      Specified by:
      layer in class Layer