- Index

< Previous |  | Next >

# StreamBase Components in Depth

A component is a JAR file that contains a property file named `ast.properties`. Components may optionally contain configuration files and notifiers. The configuration files and notifiers are specified in the `ast.properties` file. The order in which the configuration files are loaded and activated, and the notifiers executed, is also specified in the `ast.properties` file.

When a StreamBase JVM starts, all components are automatically activated in the order they are found in the class path. All component activation completes before `main` is called. The activation of all components occurs in a single transaction.

Activating Components

When a JVM exits, all components are deactivated in the reverse order in which they were activated. All component deactivation occurs in a single transaction.

Deactivating Components

The failure of any component activation during JVM startup causes the transaction to be rolled back and the JVM startup to fail. The rollback of the transaction causes the deactivation and unloading of any configuration files loaded and activated by previously successful component activations.

Component Activation Failure

During JVM shutdown, if a component attempts to contact a remote JVM on the same, or a different node, and the JVM is not available, the component deactivation transaction is rolled back and component deactivation terminates. The JVM then shuts down. The result of this failure is that any components loaded by the JVM are not deactivated. The most common reason that a remote JVM is not available is that it is also being shut down. To avoid this condition, use component notifiers to minimize the use of objects requiring access to an external JVM.

## Activation

StreamBase takes steps to activate a component:

1. Read the `ast.properties` file for the component.

2. Create an instance of each specified notifier and store the reference to prevent it from being garbage collected.

3. Call the pre-configuration initialization method for each notifier.

4. Load and activate each specified configuration file.

5. Call the post-configuration initialization method for each notifier.

Component Activation

## Deactivation

StreamBase takes these steps to deactivate a component:

1. Call the pre-configuration termination method for each notifier.

2. Deactivate and unload each configuration file in the reverse order in which they were loaded and activated.

3. Call the post-configuration termination method for each notifier.

4. Release each notifier instance in the reverse order in which they were created.

### Note

The execution order of notifier deactivation methods and JVM shutdown hooks is undefined.

Component Deactivation