Skip to content
Pierre T. edited this page Jan 9, 2015 · 1 revision

The plugin life cycle is composed of 3 steps:

  • init
  • start
  • stop

Notice that each step is done for all the plugins before moving to another step. The order between plugin is determined according to their Dependencies.

Init

The init is used to compute request results (see Request API). These computation could then be used to provide class to scan to the native module.

@Override
public InitState init(InitContext initContext) {
    ...
    return InitState.INITIALIZED;
}

The init step should return InitState.INITIALIZED, otherwise the init() method will be called again. This allows to have Multi-round plugins.

Start

At the start step the injection binding is done. This means that, you can use it in the plugin as all the plugins are bind by default.

@Inject
private MyPluginService service;

@Override
public void start() {
    service.doSomeStuff();
    logger.info("MyPlugin is starting");
}

Stop

This step is used to clean up the resources owned by the plugin before the kernel stop.

@Override
public void stop() {
    logger.info("MyPlugin is stopping");
}

Content

Clone this wiki locally