Procedure lifecycle

Each procedure runs through a complete lifecycle.

The runtime lifecycle of a procedure includes the following steps.

  1. Discovery and initialization
  2. Selection (optional)
  3. Execution
  4. Destruction

Discovery and initialization

Unica Plan must be made aware of all standard and custom procedures available for a particular installation instance. This process is called discovery.

Note: Standard procedures (procedures that are defined by the Unica Plan engineering team) are known implicitly and so do not need any action to be discovered.

Custom procedures are defined in the procedure plug-in definition file. The Unica Plan plug-in manager reads this file during initialization. For each procedure found, the plug-in manager completes the following steps.

  1. Instantiate the procedure; transition its state to INSTANTIATED.
  2. Create a procedure audit record.
  3. If the procedure was instantiated, its initialize() method is called with any initialization parameters found in its plug-in description file. If this method throws an exception, the status is logged and the procedure is abandoned. Otherwise, the procedure state changes to the INITIALIZED state. It is now ready to run.
  4. Create a procedure audit record.
  5. If the procedure was initialized, its getKey() method is called to determine the key that is used by clients to reference the procedure. This key is associated with the instance and saved for later lookup.


From time to time, Unica Plan might present a list of available procedures to users, for example to enable administrators to set up a trigger. Unica Plan only presents this list after the procedure is initialized, using the procedure's getDisplayName() and getDescription() methods.


At some point after the procedure is initialized, Unica Plan receives a request to run the procedure. This request might happen concurrently with other procedures (or the same procedure) running on other threads.

At run time, the procedure execution manager completes the following steps.

  1. Start a database transaction.
  2. Set the procedure state to EXECUTING.
  3. Create a procedure audit record.
  4. Call the procedure's execute() method with an execution context and any run parameters that are provided by the client. The method implementation uses the Unica Plan API as needed, acquiring edit locks, and passing along the execution context. If the run method throws an exception, the execution manager marks the transaction for rollback.
  5. Commit or rollback the transaction according to the execution results; set procedure state to EXECUTED.
  6. Release any outstanding edit locks.
  7. Create a procedure audit record.
Note: The execute() method is not intended to alter the procedure instance data.


When Unica Plan shuts down, the procedure plug-in manager walks through all loaded procedures. For each procedure found, it completes the following steps.

  1. Calls the procedure's destroy() method to allow the procedure to clean up before the instance is destroyed.
  2. Changes the state of the procedure to FINALIZED (it cannot be run).
  3. Creates a procedure audit record.
  4. Destroys the instance of the procedure.