Class TimerDecorator
- java.lang.Object
-
- org.forgerock.openig.decoration.helper.AbstractDecorator
-
- org.forgerock.openig.decoration.helper.AbstractHandlerAndFilterDecorator
-
- org.forgerock.openig.decoration.timer.TimerDecorator
-
- All Implemented Interfaces:
Decorator
public class TimerDecorator extends AbstractHandlerAndFilterDecorator
The timer decorator can decorate bothFilterandHandlerinstances. 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:
The value of the timeUnit is a single string representation of the elapsed time unit as those supported by{ "name": "myTimerDecorator", "type": "TimerDecorator" "config": { "timeUnit": "ms" } }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
configelement:
A default timer decorator is automatically created when OpenIG starts.{ "type": "...", "timer": true, "config": { ... } }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTimerDecorator.HeapletCreates and initializes a TimerDecorator in a heap environment.
-
Constructor Summary
Constructors Constructor Description TimerDecorator(String name)Builds a newTimerDecoratorwhere the elapsed time unit is milliseconds.TimerDecorator(String name, TimeUnit timeUnit)Builds a newTimerDecoratorwith the givenTimeUnitreference (notnull), which logs the elapsed time within the decorated heap object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.forgerock.http.FilterdecorateFilter(org.forgerock.http.Filter delegate, org.forgerock.json.JsonValue decoratorConfig, Context context)Decorates the provideddelegateFilterinstance with the provideddecoratorConfigconfiguration.protected org.forgerock.http.HandlerdecorateHandler(org.forgerock.http.Handler delegate, org.forgerock.json.JsonValue decoratorConfig, Context context)Decorates the provideddelegateHandlerinstance with the provideddecoratorConfigconfiguration.-
Methods inherited from class org.forgerock.openig.decoration.helper.AbstractHandlerAndFilterDecorator
accepts, decorate
-
Methods inherited from class org.forgerock.openig.decoration.helper.AbstractDecorator
getLogger
-
-
-
-
Constructor Detail
-
TimerDecorator
public TimerDecorator(String name)
Builds a newTimerDecoratorwhere the elapsed time unit is milliseconds.- Parameters:
name- The name of this decorator.
-
-
Method Detail
-
decorateFilter
protected org.forgerock.http.Filter decorateFilter(org.forgerock.http.Filter delegate, org.forgerock.json.JsonValue decoratorConfig, Context context) throws HeapExceptionDescription copied from class:AbstractHandlerAndFilterDecoratorDecorates the provideddelegateFilterinstance with the provideddecoratorConfigconfiguration.- Specified by:
decorateFilterin classAbstractHandlerAndFilterDecorator- Parameters:
delegate- Filter instance to be decorateddecoratorConfig- the decorator configuration to applycontext- contextual information of the decorated instance- Returns:
- a decorated filter instance (or original filter delegate)
- Throws:
HeapException- when decoration fails
-
decorateHandler
protected org.forgerock.http.Handler decorateHandler(org.forgerock.http.Handler delegate, org.forgerock.json.JsonValue decoratorConfig, Context context) throws HeapExceptionDescription copied from class:AbstractHandlerAndFilterDecoratorDecorates the provideddelegateHandlerinstance with the provideddecoratorConfigconfiguration.- Specified by:
decorateHandlerin classAbstractHandlerAndFilterDecorator- Parameters:
delegate- Handler instance to be decorateddecoratorConfig- the decorator configuration to applycontext- contextual information of the decorated instance- Returns:
- a decorated handler instance (or original handler delegate)
- Throws:
HeapException- when decoration fails
-
-