public class TimerDecorator extends AbstractHandlerAndFilterDecorator
Filter
and
Handler
instances. It will log elapsed time within the decorated heap
object.
It has to be declared inside of the heap objects section:
{
"name": "myTimerDecorator",
"type": "TimerDecorator"
}
If you want to specify the time unit:
{
"name": "myTimerDecorator",
"type": "TimerDecorator"
"config": {
"timeUnit": "ms"
}
}
The value of the timeUnit is a single string representation of the
elapsed time unit as those supported by Duration
. An invalid string
or non recognized time unit will throw an error.
To decorate a component, just add the decorator declaration next to the
config
element:
{
"type": "...",
"timer": true,
"config": { ... }
}
A default timer decorator is automatically created when OpenIG
starts.Modifier and Type | Class and Description |
---|---|
static class |
TimerDecorator.Heaplet
Creates and initializes a TimerDecorator in a heap environment.
|
Constructor and Description |
---|
TimerDecorator(String name)
Builds a new
TimerDecorator where the elapsed time unit is
milliseconds. |
TimerDecorator(String name,
TimeUnit timeUnit)
Builds a new
TimerDecorator with the given TimeUnit
reference (not null ), which logs the elapsed time within the
decorated heap object. |
Modifier and Type | Method and Description |
---|---|
protected org.forgerock.http.Filter |
decorateFilter(org.forgerock.http.Filter delegate,
org.forgerock.json.JsonValue decoratorConfig,
Context context)
Decorates the provided
delegate Filter instance with the provided decoratorConfig
configuration. |
protected org.forgerock.http.Handler |
decorateHandler(org.forgerock.http.Handler delegate,
org.forgerock.json.JsonValue decoratorConfig,
Context context)
Decorates the provided
delegate Handler instance with the provided decoratorConfig
configuration. |
accepts, decorate
getLogger
public TimerDecorator(String name)
TimerDecorator
where the elapsed time unit is
milliseconds.name
- The name of this decorator.protected org.forgerock.http.Filter decorateFilter(org.forgerock.http.Filter delegate, org.forgerock.json.JsonValue decoratorConfig, Context context) throws HeapException
AbstractHandlerAndFilterDecorator
delegate
Filter
instance with the provided decoratorConfig
configuration.decorateFilter
in class AbstractHandlerAndFilterDecorator
delegate
- Filter instance to be decorateddecoratorConfig
- the decorator configuration to applycontext
- contextual information of the decorated instanceHeapException
- when decoration failsprotected org.forgerock.http.Handler decorateHandler(org.forgerock.http.Handler delegate, org.forgerock.json.JsonValue decoratorConfig, Context context) throws HeapException
AbstractHandlerAndFilterDecorator
delegate
Handler
instance with the provided decoratorConfig
configuration.decorateHandler
in class AbstractHandlerAndFilterDecorator
delegate
- Handler instance to be decorateddecoratorConfig
- the decorator configuration to applycontext
- contextual information of the decorated instanceHeapException
- when decoration failsCopyright © 2025 Open Identity Platform Community. All rights reserved.