Class ResponseStatisticsImpl

java.lang.Object
org.glassfish.jersey.server.internal.monitoring.ResponseStatisticsImpl
All Implemented Interfaces:
ResponseStatistics

final class ResponseStatisticsImpl extends Object implements ResponseStatistics
Immutable response statistics.
  • Field Details

    • responseCodes

      private final Map<Integer,Long> responseCodes
    • lastResponseCode

      private final Integer lastResponseCode
  • Constructor Details

    • ResponseStatisticsImpl

      private ResponseStatisticsImpl(Integer lastResponseCode, Map<Integer,Long> responseCodes)
  • Method Details

    • getLastResponseCode

      public Integer getLastResponseCode()
      Description copied from interface: ResponseStatistics
      Returns the response code of a last response written by the application.
      Specified by:
      getLastResponseCode in interface ResponseStatistics
      Returns:
      Last response status code.
    • getResponseCodes

      public Map<Integer,Long> getResponseCodes()
      Description copied from interface: ResponseStatistics
      Returns statistics of response codes produces by the application. Keys of a returned map are response status codes and values is the the count of responses with these status count. Values are measured since start of the application.
      Specified by:
      getResponseCodes in interface ResponseStatistics
      Returns:
      Map with status codes keys and count as values.
    • snapshot

      public ResponseStatistics snapshot()
      Description copied from interface: ResponseStatistics
      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.
      Specified by:
      snapshot in interface ResponseStatistics
      Returns:
      Snapshot of response statistics.