@ThreadSafe public class LeaseStatsRecorder extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
LeaseStatsRecorder.LeaseStats |
| Modifier and Type | Field and Description |
|---|---|
static int |
BYTES_PER_KB |
| Constructor and Description |
|---|
LeaseStatsRecorder() |
| Modifier and Type | Method and Description |
|---|---|
void |
dropLeaseStats(String leaseKey)
Clear the in-memory stats for the lease when a lease is reassigned (due to shut down or lease stealing)
|
Double |
getThroughputKBps(String leaseKey)
Calculates the throughput in KBps for the given leaseKey.
|
void |
recordStats(@NonNull LeaseStatsRecorder.LeaseStats leaseStats)
This method provides happens-before semantics (i.e., the action (access or removal) from a thread happens
before the action from subsequent thread) for the stats recording in multithreaded environment.
|
public static final int BYTES_PER_KB
public void recordStats(@NonNull
@NonNull LeaseStatsRecorder.LeaseStats leaseStats)
public Double getThroughputKBps(String leaseKey)
renewerFrequencyInMillis from the queue and then
calculates the throughput per second during renewerFrequencyInMillis interval and then returns the
ExponentialMovingAverage of the throughput. If method is called in quick succession with or without new stats
the result can be different as ExponentialMovingAverage decays old values on every new call.
This method is thread safe.leaseKey - leaseKey for which stats are requiredpublic void dropLeaseStats(String leaseKey)
leaseKey - leaseKey, for which stats are supposed to be clear.Copyright © 2025. All rights reserved.