Class DecoratorHeaplet

java.lang.Object
org.forgerock.openig.decoration.helper.DecoratorHeaplet
All Implemented Interfaces:
Heaplet
Direct Known Subclasses:
BaseUriDecorator.Heaplet, CaptureDecorator.Heaplet, TimerDecorator.Heaplet

public abstract class DecoratorHeaplet extends Object implements Heaplet
A base class for decorator heaplets.

It supports an additional start() lifecycle method that is performed within the (Name, JsonValue, Heap) method.

This class does not attempt to perform any heap object extraction/resolution when creating objects.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected JsonValue
    The heaplet's object configuration object.
    protected Heap
    Where objects should be put and where object dependencies should be retrieved.
    protected Name
    The fully qualified name of the object to be created.
    protected Decorator
    The object created by the heaplet's create() method.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Can only be called by sub-classes.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract Decorator
    Called to request the heaplet create an object.
    create(Name name, JsonValue config, Heap heap)
    Called to request the heaplet to create an object.
    void
    Called to indicate that the object created by the heaplet is going to be dereferenced.
    protected String
    Returns the type of the IG object.
    protected org.forgerock.monitoring.api.instrument.MeterRegistryHolder
    Returns this object's MeterRegistry, creating it lazily when requested for the first time.
    void
    Called to request the heaplet start an object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • name

      protected Name name
      The fully qualified name of the object to be created.
    • config

      protected JsonValue config
      The heaplet's object configuration object.
    • heap

      protected Heap heap
      Where objects should be put and where object dependencies should be retrieved.
    • object

      protected Decorator object
      The object created by the heaplet's create() method.
  • Constructor Details

    • DecoratorHeaplet

      protected DecoratorHeaplet()
      Can only be called by sub-classes.
  • Method Details

    • create

      public Object create(Name name, JsonValue config, Heap heap) throws HeapException
      Description copied from interface: Heaplet
      Called to request the heaplet to create an object.
      Specified by:
      create in interface Heaplet
      Parameters:
      name - the name of the object to be created.
      config - the heaplet's configuration object.
      heap - the heap where object dependencies can be retrieved.
      Returns:
      the object created by the heaplet.
      Throws:
      HeapException - if an exception occurred during creation of the object or any of its dependencies.
    • destroy

      public void destroy()
      Description copied from interface: Heaplet
      Called to indicate that the object created by the heaplet is going to be dereferenced. This gives the heaplet an opportunity to free any resources that are being held prior to its dereference.
      Specified by:
      destroy in interface Heaplet
    • create

      public abstract Decorator create() throws HeapException
      Called to request the heaplet create an object. Called by create(Name, JsonValue, Heap) after initializing the protected field members. Implementations should parse configuration but not acquire resources, start threads, or log any initialization messages. These tasks should be performed by the start() method.
      Returns:
      The created object.
      Throws:
      HeapException - if an exception occurred during creation of the heap object or any of its dependencies.
      JsonValueException - if the heaplet (or one of its dependencies) has a malformed configuration.
    • start

      public void start() throws HeapException
      Called to request the heaplet start an object. Called by create(Name, JsonValue, Heap) after creating and configuring the object. Implementations should override this method if they need to acquire resources, start threads, or log any initialization messages.
      Throws:
      HeapException - if an exception occurred while starting the heap object or any of its dependencies.
    • meterRegistryHolder

      protected org.forgerock.monitoring.api.instrument.MeterRegistryHolder meterRegistryHolder() throws HeapException
      Returns this object's MeterRegistry, creating it lazily when requested for the first time.
      Returns:
      this object's MeterRegistry
      Throws:
      HeapException - should never be thrown
    • getType

      protected String getType()
      Returns the type of the IG object.
      Returns:
      the type of the IG object