Package com.atlassian.sal.api.lifecycle
Interface LifecycleAware
public interface LifecycleAware
Marker interface that indicates a component wishes to execute some code after application startup.
onStart() will be invoked:
- immediately after the host application has started up; and
- immediately after the host application has been restored from backup (if the host supports backup and restore); and
- immediately after a plugin module is enabled, if the plugin is installed or enabled manually after the host application has already started.
onStop() will be invoked only if onStart() was invoked, when dependencies are still available:
- on plugin framework shut down
- on plugin disabling
Note: for this to work a component must be exposed as an OSGi service with LifecycleAware as a declared
interface. For transformerless plugins using the atlassian spring scanner, this can be done using the ExportAsService
annotation. For transformed plugins, use a <component> with a public="true" attribute and an
<interface>com.atlassian.sal.api.lifecycle.LifecycleAware</interface> child element. For example:
<component key="my-cool-component" class="com.atlassian.stash.MyCoolComponent" public="true">
<interface>com.atlassian.sal.api.lifecycle.LifecycleAware</interface>
</component>
- Since:
- 2.0
-
Method Summary
-
Method Details
-
onStart
void onStart()Notification that the plugin is enabled and the application is started, including after being restored from backup. -
onStop
void onStop()Notification that the plugin is going to be stopped.Will be invoked if previously notified with
onStart(), before the plugin is disabled or framework is shut down.- Since:
- 3.0
-