org.jvnet.hk2.annotations
Annotation Type RunLevel


@Retention(value=RUNTIME)
@Target(value={TYPE,ANNOTATION_TYPE})
@Documented
@Inherited
@Contract
public @interface RunLevel

Defines a run/start level.

Author:
Jerome Dochez, Jeff Trent

Optional Element Summary
 Class<?> runLevelScope
          Defines the run level scope in which this RunLevel applies.
 boolean strict
          Determines whether strict constraint rules should be followed.
 int value
          Defines the run level.
 

runLevelScope

@InhabitantMetadata(value="runLevelScope")
public abstract Class<?> runLevelScope
Defines the run level scope in which this RunLevel applies.

The run level scope is any type used to segregate the application / system namespace.

Returns:
the run level scope type this annotation value applies
Default:
org.glassfish.hk2.RunLevelDefaultScope.class

value

@InhabitantMetadata(value="runLevel")
public abstract int value
Defines the run level.

Returns:
the run level
Default:
0

strict

public abstract boolean strict
Determines whether strict constraint rules should be followed.

When set to true these rules apply:

  • The RunLevelService is the one responsible for instantiation a service once the proper run level is reached during startup.
  • The RunLevelService will release the service during shutdown.
  • A non-RunLevel service cannot depend (i.e., be injected) with a RunLevel service.
  • A RunLevel service with scope X cannot depend on a RunLevel service with scope Y when X != Y
  • A RunLevel service having run level value of N can not depend (i.e., be injected) with a RunLevel service having value M when M > N.

    When set to false these rules apply:

  • The RunLevelService will not release the service during shutdown.
  • Any demand for the service (i.e., a non-run level service has demanded it) will cause the service to be instantiated.

    Returns:
    true if strict constraint rules should be followed
    Default:
    true


  • Copyright © 2012 Oracle Corporation. All Rights Reserved.