Class TimerDecorator
- java.lang.Object
-
- org.forgerock.openig.decoration.helper.AbstractDecorator
-
- org.forgerock.openig.decoration.timer.TimerDecorator
-
- All Implemented Interfaces:
Decorator
public class TimerDecorator extends AbstractDecorator
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 IG 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccepts(Class<?> type)Returnstrueif this decorator is compatible with the provided component type.DecorationHandledecorate(Object delegate, JsonValue decoratorConfig, Context context)Decorates the provideddelegateinstance with the provideddecoratorConfigconfiguration.-
Methods inherited from class org.forgerock.openig.decoration.helper.AbstractDecorator
getLogger
-
-
-
-
Method Detail
-
accepts
public boolean accepts(Class<?> type)
Description copied from interface:DecoratorReturnstrueif this decorator is compatible with the provided component type. Note that a return value oftruedoes not necessarily indicate that decoration will be performed since it may also depend on other factors- Parameters:
type- type under test- Returns:
trueif the decorator can decorate instance of the given type,falseotherwise.
-
decorate
public DecorationHandle decorate(Object delegate, JsonValue decoratorConfig, Context context) throws HeapException
Description copied from interface:DecoratorDecorates the provideddelegateinstance with the provideddecoratorConfigconfiguration. The implementation should take care of not changing the base type of the delegate.- Parameters:
delegate- instance to be decorateddecoratorConfig- the decorator configuration to applycontext- contextual information of the decorated instance- Returns:
- a handle of the decoration that was setup, never
null. - Throws:
HeapException- when decoration fails
-
-