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 both 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 IG starts.
  • Method Details

    • accepts

      public boolean accepts(Class<?> type)
      Description copied from interface: Decorator
      Returns true if this decorator is compatible with the provided component type. Note that a return value of true does not necessarily indicate that decoration will be performed since it may also depend on other factors
      Parameters:
      type - type under test
      Returns:
      true if the decorator can decorate instance of the given type, false otherwise.
    • decorate

      public DecorationHandle decorate(Object delegate, JsonValue decoratorConfig, Context context) throws HeapException
      Description copied from interface: Decorator
      Decorates the provided delegate instance with the provided decoratorConfig configuration. The implementation should take care of not changing the base type of the delegate.
      Parameters:
      delegate - instance to be decorated
      decoratorConfig - the decorator configuration to apply
      context - contextual information of the decorated instance
      Returns:
      a handle of the decoration that was setup, never null.
      Throws:
      HeapException - when decoration fails