class FrameworkStartLevelImpl extends java.lang.Object implements FrameworkStartLevel, java.lang.Runnable
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
FrameworkStartLevelImpl.BundleStartLevelImpl |
| Modifier and Type | Field and Description |
|---|---|
private static int |
BUNDLE_IDX |
private Felix |
m_felix |
private ServiceRegistry |
m_registry |
private java.util.List<FrameworkListener[]> |
m_requestListeners |
private java.util.List |
m_requests |
private ServiceRegistration<StartLevel> |
m_slReg |
private java.lang.Thread |
m_thread |
private static int |
STARTLEVEL_IDX |
(package private) static java.lang.String |
THREAD_NAME |
| Constructor and Description |
|---|
FrameworkStartLevelImpl(Felix felix,
ServiceRegistry registry) |
| Modifier and Type | Method and Description |
|---|---|
(package private) BundleStartLevel |
createBundleStartLevel(BundleImpl bundle) |
Bundle |
getBundle()
Returns the
Bundle object associated with this
BundleReference. |
int |
getInitialBundleStartLevel()
Return the initial start level value that is assigned to a Bundle when it
is first installed.
|
int |
getStartLevel()
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 |
startThread() |
(package private) void |
stop()
Stops the FelixStartLevel thread on system shutdown.
|
static final java.lang.String THREAD_NAME
private static final int BUNDLE_IDX
private static final int STARTLEVEL_IDX
private final Felix m_felix
private final ServiceRegistry m_registry
private final java.util.List m_requests
private final java.util.List<FrameworkListener[]> m_requestListeners
private ServiceRegistration<StartLevel> m_slReg
private java.lang.Thread m_thread
FrameworkStartLevelImpl(Felix felix, ServiceRegistry registry)
void start()
private void startThread()
void stop()
This method is called by the
StartLevelActivator#stop(BundleContext) method.
public Bundle getBundle()
BundleReferenceBundle object associated with this
BundleReference.getBundle in interface BundleReferenceBundle object associated with this
BundleReference.public int getStartLevel()
FrameworkStartLevelgetStartLevel in interface FrameworkStartLevelpublic void setStartLevel(int startlevel,
FrameworkListener... listeners)
FrameworkStartLevel
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 specified
FrameworkListener will be called with a Framework event of type
FrameworkEvent.STARTLEVEL_CHANGED. If the start level change does
not complete normally, each specified FrameworkListener will be
called with a Framework event of type FrameworkEvent.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:
Bundle.start(int) method using the Bundle.START_TRANSIENT
option. The Bundle.START_ACTIVATION_POLICY option must also be
used if BundleStartLevel.isActivationPolicyUsed() returns
true 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:
Bundle.stop(int) method using the Bundle.STOP_TRANSIENT
option.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.
setStartLevel in interface FrameworkStartLevelstartlevel - 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.void setStartLevelAndWait(int startlevel)
startlevel - public int getInitialBundleStartLevel()
FrameworkStartLevelgetInitialBundleStartLevel in interface FrameworkStartLevelFrameworkStartLevel.setInitialBundleStartLevel(int)public void setInitialBundleStartLevel(int startlevel)
FrameworkStartLevelThe 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.
setInitialBundleStartLevel in interface FrameworkStartLevelstartlevel - The initial start level for newly installed bundles.BundleStartLevel createBundleStartLevel(BundleImpl bundle)
public void run()
run in interface java.lang.Runnable