Class ResponseStatisticsImpl
- java.lang.Object
-
- org.glassfish.jersey.server.internal.monitoring.ResponseStatisticsImpl
-
- All Implemented Interfaces:
ResponseStatistics
final class ResponseStatisticsImpl extends java.lang.Object implements ResponseStatistics
Immutable response statistics.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ResponseStatisticsImpl.Builder
This builder does not need to be threadsafe since it's called only from the jersey-background-task-scheduler.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Integer
lastResponseCode
private java.util.Map<java.lang.Integer,java.lang.Long>
responseCodes
-
Constructor Summary
Constructors Modifier Constructor Description private
ResponseStatisticsImpl(java.lang.Integer lastResponseCode, java.util.Map<java.lang.Integer,java.lang.Long> responseCodes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Integer
getLastResponseCode()
Returns the response code of a last response written by the application.java.util.Map<java.lang.Integer,java.lang.Long>
getResponseCodes()
Returns statistics of response codes produces by the application.ResponseStatistics
snapshot()
Get the immutable and consistent snapshot of the monitoring statistics.
-
-
-
Method Detail
-
getLastResponseCode
public java.lang.Integer getLastResponseCode()
Description copied from interface:ResponseStatistics
Returns the response code of a last response written by the application.- Specified by:
getLastResponseCode
in interfaceResponseStatistics
- Returns:
- Last response status code.
-
getResponseCodes
public java.util.Map<java.lang.Integer,java.lang.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 interfaceResponseStatistics
- 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 interfaceResponseStatistics
- Returns:
- Snapshot of response statistics.
-
-