Class FrameworkStartLevelImpl
- All Implemented Interfaces:
Runnable
,BundleReference
,FrameworkStartLevel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private final Felix
private final ServiceRegistry
private final List
<FrameworkListener[]> private final List
private ServiceRegistration
<StartLevel> private Thread
private static final int
(package private) static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) BundleStartLevel
createBundleStartLevel
(BundleImpl bundle) Returns theBundle
object associated with thisBundleReference
.int
Return the initial start level value that is assigned to a Bundle when it is first installed.int
Return the active start level value of the Framework.void
run()
void
setInitialBundleStartLevel
(int startlevel) Set the initial start level value that is assigned to a Bundle when it is first installed.void
setStartLevel
(int startlevel, FrameworkListener... listeners) Modify the active start level of the Framework and notify when complete.(package private) void
setStartLevelAndWait
(int startlevel) This method is currently only called by the by the thread that calls the Felix.start() method and the shutdown thread when the framework is shutting down.(package private) void
start()
private void
(package private) void
stop()
Stops the FelixStartLevel thread on system shutdown.
-
Field Details
-
THREAD_NAME
- See Also:
-
BUNDLE_IDX
private static final int BUNDLE_IDX- See Also:
-
STARTLEVEL_IDX
private static final int STARTLEVEL_IDX- See Also:
-
m_felix
-
m_registry
-
m_requests
-
m_requestListeners
-
m_slReg
-
m_thread
-
-
Constructor Details
-
FrameworkStartLevelImpl
FrameworkStartLevelImpl(Felix felix, ServiceRegistry registry)
-
-
Method Details
-
start
void start() -
startThread
private void startThread() -
stop
void stop()Stops the FelixStartLevel thread on system shutdown. Shutting down the thread explicitly is required in the embedded case, where Felix may be stopped without the Java VM being stopped. In this case the FelixStartLevel thread must be stopped explicitly.This method is called by the
invalid reference
StartLevelActivator#stop(BundleContext)
-
getBundle
Description copied from interface:BundleReference
Returns theBundle
object associated with thisBundleReference
.- Specified by:
getBundle
in interfaceBundleReference
- Returns:
- The
Bundle
object associated with thisBundleReference
.
-
getStartLevel
public int getStartLevel()Description copied from interface:FrameworkStartLevel
Return the active start level value of the Framework. If the Framework is in the process of changing the start level this method must return the active start level if this differs from the requested start level.- Specified by:
getStartLevel
in interfaceFrameworkStartLevel
- Returns:
- The active start level value of the Framework.
-
setStartLevel
Description copied from interface:FrameworkStartLevel
Modify the active start level of the Framework and notify when complete.The Framework will move to the requested start level. This method will return immediately to the caller and the start level change will occur asynchronously on another thread. The specified
FrameworkListener
s are notified, in the order specified, when the start level change is complete. When the start level change completes normally, each specifiedFrameworkListener
will be called with a Framework event of typeFrameworkEvent.STARTLEVEL_CHANGED
. If the start level change does not complete normally, each specifiedFrameworkListener
will be called with a Framework event of typeFrameworkEvent.ERROR
.If the specified start level is higher than the active start level, the Framework will continue to increase the start level until the Framework has reached the specified start level. At each intermediate start level value on the way to and including the target start level, the Framework must:
- Change the active start level to the intermediate start level value.
- Start bundles at the intermediate start level whose autostart setting
indicate they must be started. They are started as described in the
Bundle.start(int)
method using theBundle.START_TRANSIENT
option. TheBundle.START_ACTIVATION_POLICY
option must also be used ifBundleStartLevel.isActivationPolicyUsed()
returnstrue
for the bundle.
FrameworkEvent.STARTLEVEL_CHANGED
to announce it has moved to the specified start level.If the specified start level is lower than the active start level, the Framework will continue to decrease the start level until the Framework has reached the specified start level. At each intermediate start level value on the way to and including the specified start level, the framework must:
- Stop bundles at the intermediate start level as described in the
Bundle.stop(int)
method using theBundle.STOP_TRANSIENT
option. - Change the active start level to the intermediate start level value.
FrameworkEvent.STARTLEVEL_CHANGED
to announce it has moved to the specified start level.If the specified start level is equal to the active start level, then no bundles are started or stopped, however, the Framework must fire a Framework event of type
FrameworkEvent.STARTLEVEL_CHANGED
to announce it has finished moving to the specified start level. This event may arrive before this method returns.- Specified by:
setStartLevel
in interfaceFrameworkStartLevel
- Parameters:
startlevel
- The requested start level for the Framework.listeners
- Zero or more listeners to be notified when the start level change has been completed. The specified listeners do not need to be otherwise registered with the framework. If a specified listener is already registered with the framework, it will be notified twice.
-
setStartLevelAndWait
void setStartLevelAndWait(int startlevel) This method is currently only called by the by the thread that calls the Felix.start() method and the shutdown thread when the framework is shutting down.- Parameters:
startlevel
-
-
getInitialBundleStartLevel
public int getInitialBundleStartLevel()Description copied from interface:FrameworkStartLevel
Return the initial start level value that is assigned to a Bundle when it is first installed.- Specified by:
getInitialBundleStartLevel
in interfaceFrameworkStartLevel
- Returns:
- The initial start level value for Bundles.
- See Also:
-
setInitialBundleStartLevel
public void setInitialBundleStartLevel(int startlevel) Description copied from interface:FrameworkStartLevel
Set the initial start level value that is assigned to a Bundle when it is first installed.The initial bundle start level will be set to the specified start level. The initial bundle start level value will be persistently recorded by the Framework.
When a Bundle is installed via
BundleContext.installBundle
, it is assigned the initial bundle start level value.The default initial bundle start level value is 1 unless this method has been called to assign a different initial bundle start level value.
This method does not change the start level values of installed bundles.
- Specified by:
setInitialBundleStartLevel
in interfaceFrameworkStartLevel
- Parameters:
startlevel
- The initial start level for newly installed bundles.
-
createBundleStartLevel
-
run
public void run()
-