Top Description Fields Constructors Methods
org.eclipse.jetty.util.statistic

public Class CounterStatistic

extends Object
Class Inheritance
Imports
java.util.concurrent.atomic.AtomicLong, .LongAccumulator, .LongAdder

Statistics on a counter value.

This class keeps the total, current and maximum value of a counter that can be incremented and decremented. The total refers only to increments.

Field Summary

Modifier and TypeField and Description
private final AtomicLong
private final LongAccumulator
private final LongAdder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

the new counter value
add
(final long
the amount to add to the counter
delta
)

public long

Returns:

the new counter value after the decrement
decrement
()

Decrements the value by one.

public long

Returns:

current counter value
getCurrent
()

Get current counter value.

public long

Returns:

max counter value
getMax
()

Get max counter value.

public long

Returns:

total counter value
getTotal
()

Get total counter value.

public long

Returns:

the new counter value after the increment
increment
()

Increments the value by one.

public void
reset()

Resets the max and total to the current value.

public void
reset(final long
the new current value
value
)

Resets the max, total and current value to the given parameter.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_currentback to summary
private final AtomicLong _current
_maxback to summary
private final LongAccumulator _max
_totalback to summary
private final LongAdder _total

Constructor Detail

CounterStatisticback to summary
public CounterStatistic()

Method Detail

addback to summary
public long add(final long delta)
Parameters
delta:long

the amount to add to the counter

Returns:long

the new counter value

decrementback to summary
public long decrement()

Decrements the value by one.

Returns:long

the new counter value after the decrement

getCurrentback to summary
public long getCurrent()

Get current counter value.

Returns:long

current counter value

getMaxback to summary
public long getMax()

Get max counter value.

Returns:long

max counter value

getTotalback to summary
public long getTotal()

Get total counter value.

Returns:long

total counter value

incrementback to summary
public long increment()

Increments the value by one.

Returns:long

the new counter value after the increment

resetback to summary
public void reset()

Resets the max and total to the current value.

resetback to summary
public void reset(final long value)

Resets the max, total and current value to the given parameter.

Parameters
value:long

the new current value

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override