Instance life-cycle management


Instance creation and destruction

As in standard OSGi, component instances are created and destroyed as the physical bundles that contain them are activated and de-activated. It must be noted that for every component description inside a component descriptor, a single component instance is created.

Creation and destruction of component instances outside of deployment activities is possible through the factory concept (available from version 1.2).

Service dependency management

During execution, every component instance is managed independently by an instance manager that takes in charge service registration and service dependency management activities based on the information present in the component descriptor. The instance manager is a container that manages the instance's life-cycle through control methods and interfaces, which are only visible to the instance manager, following the Inversion of Control pattern (see figure 1).

 
Figure 1. Instance managers

A component instance is in one of two states: valid or invalid. When an instance is valid, its services are registered in the service registry and it is active (i.e., executing). When an instance is invalid, its services are not registered in the service registry and it is not active. When an instance is created, it is initially invalid. After creation, the instance manager enters a configuration phase (see figure 2). At this point, it creates bindings between the instance it manages and other instances that provide services required by the managed instance. Configuration can only succeed if bindings can be created for required service interfaces that are categorized as being mandatory.

instance manager states

Figure 2. Instance manager states.

After configuration, the instance manager activates the component instance, and registers its services in the service registry. At that point the instance is valid. If configuration fails, the instance manager waits for the arrival of services that can be used to configure the instance. As soon as all mandatory services become present, the instance is validated.

During execution, the instance manager receives notifications from the service registry. These notifications can trigger re-configuration activities, which depend on the dependency properties associated to the component that is being managed. The behavior of the instance manager with respect to the service dependency properties is summarized in table 1.

It must be noted that the instance manager's goal is to constantly maintain the validity of the instance it manages. This is represented by the transition between the execution and configuration states.

Cardinality and policy
Instance manager's behavior
1..1, static

Configuration: The required service interface corresponds to a single binding that must be created for the instance to be validated.

Execution: The destruction of the binding invalidates the instance

1..1, dynamic

Configuration: The required service interface corresponds to a single binding that must be created for the instance to be validated.

Execution: If the binding is destroyed because of a change in the instance that provides the service, the instance manager tries to create a replacing binding. If this binding cannot be created, the instance is invalidated.

1..n, static

Configuration: The required service interface corresponds to a set of bindings of which at least one must be created for the instance to be validated. The instance manager creates bindings with all the available service providers at the moment of configuration.


Execution: The destruction of any binding invalidates the instance. No new bindings can be created.

1..n, dynamic

Configuration: The required service interface corresponds to a set of bindings of which at least one must be created for the instance to be validated. The instance manager creates bindings with all the available service providers at the moment of configuration.

Execution: New bindings can be created or existing bindings can be destroyed as long as there is one binding. If the last binding is destroyed, the instance is invalidated.

0..1, static

Configuration: The required service interface corresponds to a single binding that does not need to be created for the instance to be validated.

Execution: If the binding was created during configuration, the destruction of the binding invalidates the instance. If the binding was not created during configuration, it cannot be created during execution. If no binding was created during configuration, the instance is not invalidated until its destruction.

0..1, dynamic

Configuration: The required service interface corresponds to a single binding that does not need to be created for the instance to be validated.

Execution: The binding can be created or destroyed during execution without the instance being invalidated. Instance invalidation only occurs when the instance is destroyed.

0..n, static

Configuration: The required service interface corresponds to a set of bindings that do not need to be created for the instance to be validated. The instance manager creates bindings with all the available service providers at the moment of configuration.

Execution: The destruction of any binding invalidates the instance. No new bindings can be created. If no bindings were created, the instance is not invalidated until it is destroyed.

0..n, dynamic

Configuration: The required service interface corresponds to a set of bindings that do not need to be created for the instance to be validated. The instance manager creates bindings with all the available service providers at the moment of configuration.

Execution: New bindings can be created and bindings can be destroyed. Instance invalidation only occurs when the instance is destroyed.

Table 1. Service dependency properties and the instance manager's behavior.


Last revision: 20 January 2004
(c) H. Cervantes and R.S. Hall

Next : Execution environment

Previous : Service components

Index