Class TimeWindowStatisticsImpl
- java.lang.Object
-
- org.glassfish.jersey.server.internal.monitoring.TimeWindowStatisticsImpl
-
- All Implemented Interfaces:
TimeWindowStatistics
final class TimeWindowStatisticsImpl extends java.lang.Object implements TimeWindowStatistics
ImmutableTime window statisticsthat uses backingSlidingWindowTimeReservoirfor itsBuilderimplementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classTimeWindowStatisticsImpl.Builder<V>Builder of time window statistics.
-
Field Summary
Fields Modifier and Type Field Description private longaverageDurationprivate static java.util.concurrent.ConcurrentHashMap<java.lang.Long,TimeWindowStatisticsImpl>EMPTYprivate longintervalprivate longmaximumDurationprivate longminimumDurationprivate doublerequestsPerSecondprivate longtotalCount
-
Constructor Summary
Constructors Modifier Constructor Description privateTimeWindowStatisticsImpl(long interval, double requestsPerSecond, long minimumDuration, long maximumDuration, long averageDuration, long totalCount)privateTimeWindowStatisticsImpl(long interval, UniformTimeSnapshot snapshot)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetAverageDuration()Returns the average duration (processing time) in milliseconds of the request processing measured in the time window.longgetMaximumDuration()Returns the maximum duration (processing time) in milliseconds of the request processing measured in the time window.longgetMinimumDuration()Returns the minimum duration (processing time) in milliseconds of the request processing measured in the time window.longgetRequestCount()Returns the count of requests received measured in the time window.doublegetRequestsPerSecond()Returns average value of how many requests per second were received by application in the time window.longgetTimeWindow()Returns the size of time window in milliseconds.TimeWindowStatisticssnapshot()Get the immutable and consistent snapshot of the monitoring statistics.
-
-
-
Field Detail
-
EMPTY
private static final java.util.concurrent.ConcurrentHashMap<java.lang.Long,TimeWindowStatisticsImpl> EMPTY
-
interval
private final long interval
-
minimumDuration
private final long minimumDuration
-
maximumDuration
private final long maximumDuration
-
averageDuration
private final long averageDuration
-
totalCount
private final long totalCount
-
requestsPerSecond
private final double requestsPerSecond
-
-
Constructor Detail
-
TimeWindowStatisticsImpl
private TimeWindowStatisticsImpl(long interval, double requestsPerSecond, long minimumDuration, long maximumDuration, long averageDuration, long totalCount)
-
TimeWindowStatisticsImpl
private TimeWindowStatisticsImpl(long interval, UniformTimeSnapshot snapshot)
-
-
Method Detail
-
getTimeWindow
public long getTimeWindow()
Description copied from interface:TimeWindowStatisticsReturns the size of time window in milliseconds. Returned value denotes in how many last milliseconds the statistics are evaluated.- Specified by:
getTimeWindowin interfaceTimeWindowStatistics- Returns:
- Time window in milliseconds.
-
getRequestsPerSecond
public double getRequestsPerSecond()
Description copied from interface:TimeWindowStatisticsReturns average value of how many requests per second were received by application in the time window.- Specified by:
getRequestsPerSecondin interfaceTimeWindowStatistics- Returns:
- Average of requests per second.
-
getMinimumDuration
public long getMinimumDuration()
Description copied from interface:TimeWindowStatisticsReturns the minimum duration (processing time) in milliseconds of the request processing measured in the time window. The time measures the processing of the request since the start of request processing by Jersey until the response is written or request processing fails and all resources for request processing are released.- Specified by:
getMinimumDurationin interfaceTimeWindowStatistics- Returns:
- Minimum processing time of the request or -1 if no request has been processed.
-
getMaximumDuration
public long getMaximumDuration()
Description copied from interface:TimeWindowStatisticsReturns the maximum duration (processing time) in milliseconds of the request processing measured in the time window. processing of the request since the start of request processing by Jersey until the response is written or request processing fails and all resources for request processing are released.- Specified by:
getMaximumDurationin interfaceTimeWindowStatistics- Returns:
- Maximum processing time of the request or -1 if no request has been processed.
-
getRequestCount
public long getRequestCount()
Description copied from interface:TimeWindowStatisticsReturns the count of requests received measured in the time window.- Specified by:
getRequestCountin interfaceTimeWindowStatistics- Returns:
- Count of requests that were handled by the application.
-
snapshot
public TimeWindowStatistics snapshot()
Description copied from interface:TimeWindowStatisticsGet 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:
snapshotin interfaceTimeWindowStatistics- Returns:
- Snapshot of time window statistics.
-
getAverageDuration
public long getAverageDuration()
Description copied from interface:TimeWindowStatisticsReturns the average duration (processing time) in milliseconds of the request processing measured in the time window. The time measures the processing of the request since the start of request processing by Jersey until the response is written or request processing fails and all resources for request processing are released.- Specified by:
getAverageDurationin interfaceTimeWindowStatistics- Returns:
- Average processing time of the request or -1 if no request has been processed.
-
-