Click on Javadoc link to open Javadoc documentation.
Package
org.gridgain.grid.spi.discovery.jboss ![]()
Description
JBoss implementation of GridDiscoverySpi ![]()
![]()
![]()
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. |
Configuration
The following configuration parameters can be used to configure GridJbossDiscoverySpi
| Setter Method | Description | Optional | Default |
|---|---|---|---|
| setPartitionJndiName(String) |
Sets cluster HA partition JNDI name. | Yes | /HAPartition/DefaultPartition (specified by GridJbossDiscoverySpi.DFLT_PARTITION_JNDI_NAME |
| setMetricsFrequency(long) |
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 |
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.
- Create folder ${JBOSS_HOME}/server/all/deploy/gridgain.sar with SAR loader GridJbossLoader
Javadoc .
- Copy files ${GRIDGAIN_HOME}/libs/*.jar and ${GRIDGAIN_HOME}/gridgain_x.x.x-ddmmyyy.jar to ${JBOSS_HOME}/server/all/deploy/gridgain.sar.
- 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.
