Interface ResourceMethodStatistics


  • public interface ResourceMethodStatistics
    Monitoring statistics an of an execution of the resource method. The snapshot() method returns an immutable snapshot with consistent data. The principles of using statistics is similar to principles of using MonitoringStatistics.

    Statistics contain two ExecutionStatistics where getMethodStatistics() contains statistics for execution of the code of resource method and getRequestStatistics() contains statistics for complete processing of requests that were matched to the resource method. This implies that getRequestStatistics() will tend to contain higher time measurements as they measure total request processing time and not only execution of the resource method.

    Statistics retrieved from Jersey runtime might be mutable and thanks to it might provide inconsistent data as not all statistics are updated in the same time. To retrieve the immutable and consistent statistics data the method snapshot() should be used.

    Author:
    Miroslav Fuksa
    See Also:
    See monitoring statistics for more details.
    • Method Detail

      • getMethodStatistics

        ExecutionStatistics getMethodStatistics()
        Get execution statistics that contain measurements of times only for execution of resource method. Durations average time, minimum time and maximum time measure only time of execution of resource method code. It does not involve other request processing phases.
        Returns:
        Execution statistics of one resource method.
      • getRequestStatistics

        ExecutionStatistics getRequestStatistics()
        Get execution statistics that contain measurements of times for whole processing from time when request comes into the Jersey application until the response is written to the underlying IO container. The statistics involves only requests that were matched to resource method defined by getResourceMethod().
        Returns:
        Execution statistics of entire request processing for one resource method.
      • snapshot

        @Deprecated
        ResourceMethodStatistics snapshot()
        Deprecated.
        implementing class is immutable hence snapshot creation is not needed anymore
        Get the immutable and consistent snapshot of the monitoring statistics. Working with snapshots might have negative performance impact as snapshot must be created but ensures consistency of data over time. However, the usage of snapshot is encouraged to avoid working with inconsistent data. Not all statistics must be updated in the same time on mutable version of statistics.
        Returns:
        Snapshot of resource method statistics.