GridGain™ 3.6.0e
Enterprise Edition

org.gridgain.grid
Interface GridLifecycleBean


public interface GridLifecycleBean

A bean that reacts to grid lifecycle events defined in GridLifecycleEventType. Use this bean whenever you need to plug some custom logic before or after grid startup and stopping routines.

There are four events you can react to:

Resource Injection

Lifecycle beans can be injected using IoC (dependency injection) with grid resources. Both, field and method based injection are supported. The following grid resources can be injected: Refer to corresponding resource documentation for more information.

Usage

If you need to tie your application logic into GridGain lifecycle, you can configure lifecycle beans via standard grid configuration, add your application library dependencies into GRIDGAIN_HOME/libs/ext folder, and simply start GRIDGAIN_HOME/ggstart.{sh|bat} scripts.

Configuration

Grid lifecycle beans can be configured programmatically as follows:
 Collection<GridLifecycleBean> lifecycleBeans = new ArrayList<GridLifecycleBean>();

 Collections.addAll(lifecycleBeans, new FooBarLifecycleBean1(), new FooBarLifecycleBean2());

 GridConfigurationAdapter cfg = new GridConfigurationAdapter();

 cfg.setLifecycleBeans(lifecycleBeans);

 // Start grid with given configuration.
 G.start(cfg);
 
or from Spring XML configuration file as follows:
 <bean id="grid.cfg" class="org.gridgain.grid.GridConfigurationAdapter" scope="singleton">
    ...
    <property name="lifecycleBeans">
       <list>
          <bean class="foo.bar.FooBarLifecycleBean1"/>
          <bean class="foo.bar.FooBarLifecycleBean2"/>
       </list>
    </property>
    ...
 </bean>
 

Wiki & Forum:


Wiki
Forum

 

Method Summary
 void onLifecycleEvent(GridLifecycleEventType evt)
          This method is called when lifecycle event occurs.
 

Method Detail

onLifecycleEvent

void onLifecycleEvent(GridLifecycleEventType evt)
                      throws GridException
This method is called when lifecycle event occurs.

Throws:
GridException - Thrown in case of any errors.
Parameters:
evt - Lifecycle event.

GridGain™ 3.6.0e
Enterprise Edition

GridGain - Real Time Big Data
Enterprise Edition, ver. 3.6.0e.13012012
2012 Copyright © GridGain Systems
Follow us:   Follow GridGain on Github Follow GridGain on Facebook Join GridGain User Group Follow GridGain on Twitter Follow GridGain on YouTube