Dashboard > GridGain User Guide > Table Of Contents > Developers Guide > Discovery SPI > GridJbossDiscoverySpi
GridJbossDiscoverySpi
Added by user-1-ds, last edited by morpheus on Feb 21, 2008  (view change)
Labels: 
(None)


Click on Javadoc link to open Javadoc documentation.

Package

org.gridgain.grid.spi.discovery.jboss Javadoc

Description

JBoss implementation of GridDiscoverySpi Javadoc SPI. It uses JBoss cluster architecture to discover nodes in the grid. SPI registers in cluster service with the name GridJbossDiscoverySpi.DISCO_SERVICE_NAME Javadoc and every node in the cluster makes cluster method call with name GridJbossDiscoverySpi.DISCO_METHOD_NAME Javadoc to receive the remote node data.

All JBoss cluster configuration parameters like multicast groups, ports and etc. should be defined in cluster-service.xml.

JBoss HA

Note that when using jboss-spring.xml configuration file it requires JBoss configured with HA. JBoss 'default' and 'minimal' configuration are not set with HA support. Only 'all' JBoss configuration includes HA setup. Unless HA support is set GridGain will not start with jboss-spring.xml configuration since it uses JBoss discovery SPI that's relying on HA. See this link for details on how to setup HA support in JBoss: http://www.jboss.org/wiki/Wiki.jsp?page=JBossHA

If you change jboss-service.xml to use default-spring.xml (that's using IP multicast-based discovery SPI) GridGain will start with any of the JBoss configurations.

JBoss AS versions

This SPI use HAPartition.HAMembershipExtendedListener from JBoss Cluster API.
See bug http://jira.jboss.com/jira/browse/JBAS-3833 and fixed JBoss AS versions: JBossAS-5.0.0.Beta1, JBossAS-4.2.0.CR1, JBossAS-4.0.5.SP1 and higher.

Configuration

The following configuration parameters can be used to configure GridJbossDiscoverySpi

Setter Method Description Optional Default
setPartitionJndiName(String) Javadoc Sets cluster HA partition JNDI name. Yes /HAPartition/DefaultPartition (specified by GridJbossDiscoverySpi.DFLT_PARTITION_JNDI_NAME Javadoc )
setMetricsFrequency(long) Javadoc Sets delay between metrics requests. SPI sends broadcast messages in configurable time interval to other nodes to notify them about its metrics. (Since 1.6.2) Yes 60000 (specified by GridJbossDiscoverySpi.DFLT_METRICS_FREQ Javadoc )

Examples

GridJbossDiscoverySpi needs to be explicitly configured to override default Multicast discovery SPI.

GridJbossDiscoverySpi spi = new GridJbossDiscoverySpi();

GridConfigurationAdapter cfg = new GridConfigurationAdapter();

// Override default discovery SPI.
cfg.setDiscoverySpi(spi);

// Start grid.
GridFactory.start(cfg);

or from Spring configuration file

<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfigurationAdapter" singleton="true">
        ...
        <property name="discoverySpi">
            <bean class="org.gridgain.grid.spi.discovery.jboss.GridJbossDiscoverySpi"/>
        </property>
        ...
</bean>

Simple SAR application example.

In the example below described how to create JBoss SAR application and start Grid with GridJbossDiscoverySpi SPI.

  1. Create folder ${JBOSS_HOME}/server/all/deploy/gridgain.sar with SAR loader GridJbossLoader Javadoc .
  2. Copy files ${GRIDGAIN_HOME}/libs/*.jar and ${GRIDGAIN_HOME}/gridgain_x.x.x-ddmmyyy.jar to ${JBOSS_HOME}/server/all/deploy/gridgain.sar.
  3. Copy jboss-service.xml described below in folder ${JBOSS_HOME}/server/all/deploy/gridgain.sar/META-INF
    <!DOCTYPE server PUBLIC "-//JBoss//DTD MBean Service 4.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-service_4_0.dtd">
    
    <!--
        JBoss service descriptor for GridGain JBoss Loader.
    
        Codebase should contain the following libraries:
        - $GRIDGAIN_HOME/libs/*.jar
        - $GRIDGAIN_HOME/gridgain_x.x.x-ddmmyyy.jar
    -->
    
    <server>
        <classpath codebase=".." />
    
        <mbean code="org.gridgain.grid.loaders.jboss.GridJbossLoader" name="gridgain:service=loader">
            <attribute name="ConfigurationFile">config/loader/jboss-spring.xml</attribute>
    
            <!-- Change the partition name to whatever name is used in JBoss. -->
            <depends>jboss:service=${jboss.partition.name:DefaultPartition}</depends>
        </mbean>
    </server>

    Use default ${GRIDGAIN_HOME}/config/loader/jboss-spring.xml or put another config file with defined configured GridJbossDiscoverySpi SPI.


For more information about using Spring framework for configuration click here.

Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.10 Build:#528 Nov 29, 2006) - Bug/feature request - Contact Administrators