Collection Policy
All runtime instances associated with a component are maintained under reference objects. The reference object that is selected by the runtime is determined by the component collection policy. The following table lists available collection policies and related semantics.
Policy | Description |
---|---|
HARD | The default HARD policy ensures that an instance reference will be maintained for the life of the enclosing component model unless explicitly destroyed as a result of container shutdown or management request. The HARD collection policy should not be used in conjunction with TRANSIENT lifestyle. |
SOFT | If no objects have a reference to the runtime instance and memory contention occurs, component instances held under the SOFT collection will be garbage collected. |
WEAK | If no objects have a reference to the runtime instance the instance will be garbage collected at the discretion of the JVM. |
Default Policy
Unless an alternative collection policy is declared as an annotation or as a feature of a packaged profile, or a feature of a strategy declaration, the HARD collection policy is assumed.