Class RequestContext

  • All Implemented Interfaces:
    Context

    public class RequestContext
    extends CoreContext
    Additional context which might be attached to an individual Request.
    Since:
    2.0.0
    • Method Detail

      • dispatchLatency

        @Volatile
        public long dispatchLatency()
        Returns the duration of the dispatch phase if set.
        Returns:
        the duration of the dispatch phase.
      • dispatchLatency

        @Internal
        public RequestContext dispatchLatency​(long dispatchLatency)
        Allows to set the dispatch duration of the request.
        Parameters:
        dispatchLatency - the duration.
      • encodeLatency

        @Volatile
        public long encodeLatency()
      • serverLatency

        @Volatile
        public long serverLatency()
      • logicallyComplete

        @Internal
        public RequestContext logicallyComplete()
        Signals that this request is completed fully, including streaming sections or logical sub-requests also being completed (i.e. observe polling).
      • retryAttempts

        public int retryAttempts()
      • lastRetryDuration

        public Duration lastRetryDuration()
      • logicallyCompletedAt

        public long logicallyCompletedAt()
        Returns the absolute nano time when the request got logically completed.
      • logicalRequestLatency

        public long logicalRequestLatency()
        Returns the request latency once logically completed (includes potential "inner" operations like observe calls).
      • lastDispatchedTo

        public HostAndPort lastDispatchedTo()
      • lastDispatchedFrom

        public HostAndPort lastDispatchedFrom()
      • clientContext

        public Map<String,​Object> clientContext()
        Returns the custom user payload of this request.
        Returns:
        the payload if set.
      • clientContext

        @Internal
        public RequestContext clientContext​(Map<String,​Object> clientContext)
        Allows to set a custom payload for this request.
        Parameters:
        clientContext - the payload to set.
      • injectExportableParams

        public void injectExportableParams​(Map<String,​Object> input)
        Description copied from class: AbstractContext
        This method needs to be implemented by the actual context implementations to inject the params they need for exporting.
        Overrides:
        injectExportableParams in class CoreContext
        Parameters:
        input - pass exportable params in here.
      • cancel

        @Uncommitted
        public RequestContext cancel()
        Allows to cancel the attached Request from anywhere in the code.

        If the operation is already completed (either successfully or failed) this is an operation without side-effect.