public class ThreadLocalOpTimerFactory extends Object implements ThreadOpTimerFactory
snapshotAndClear()
in a finally block after each request to ensure that the thread local storage is removed. Failure to do so will
result in memory leaks.| Constructor and Description |
|---|
ThreadLocalOpTimerFactory() |
| Modifier and Type | Method and Description |
|---|---|
OpTimer |
createOpTimer(String name,
boolean captureCPUCost,
OpTimer.OnEndCallback endCallback)
This creates an OpTimer based on the passed in name and that will invoke the callback
when end is called.
|
OpRegistry |
getOpRegistry() |
List<OpSnapshot> |
snapshotAndClear()
This will snapshot the thread local
OpRegistry and remove its associated storage. |
public OpTimer createOpTimer(String name, boolean captureCPUCost, OpTimer.OnEndCallback endCallback)
OpTimerFactorycreateOpTimer in interface OpTimerFactorycreateOpTimer in interface ThreadOpTimerFactoryname - the name of the OpTimercaptureCPUCost - true of the CPU cost of the operation is to be capturedendCallback - a call backed to be invokd when end is called on the OpTimerpublic OpRegistry getOpRegistry()
getOpRegistry in interface ThreadOpTimerFactoryOpRegistry for the current threadpublic List<OpSnapshot> snapshotAndClear()
OpRegistry and remove its associated storage.
You should call this at the end of a request in a finally block to get a snapshot of the counters for that request thread and then reset it for the next set of requests.
snapshotAndClear in interface ThreadOpTimerFactoryCopyright © 2016 Atlassian. All rights reserved.