GridGain™ 2.1.0
Java API Specification

org.gridgain.grid
Interface GridLifecycleBean


@Apache20LicenseCompatible
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_HOMNE/gridgain.{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.
 GridFactory.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>
 




See Also:

  Documentation
  Email Support
  Online Forums
  Issue Tracking

Author:   2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.1.0

 

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

Method Detail

onLifecycleEvent

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

Parameters:
evt - Lifecycle event.

GridGain™ 2.1.0
Java API Specification

GridGain™ - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved.