Dashboard > GridGain User Guide > Table Of Contents > Developers Guide > Communication SPI > GridJgroupsCommunicationSpi
GridJgroupsCommunicationSpi
Added by user-1-ds, last edited by ghost on Jan 11, 2008  (view change)
Labels: 
(None)


Click on Javadoc link to open Javadoc documentation.

Package

org.gridgain.grid.spi.communication.jgroups Javadoc

Description

GridJgroupsCommunicationSpi Javadoc provides JGroups implementation of GridCommunicationSpi Javadoc . JGroups is an opensource product that provides reliable UDP/multicast implementation among other things. You can find documentation about JGroups at JGroups Project.

To enable communication with other nodes, this SPI adds GridJgroupsCommuncationSpi.ATTR_ADDR Javadoc local node attribute.

At startup, this SPI will load JGroups configuration file from specified path, create a JGroups channel and connect to the group specified. Both, configuration path and group name are configurable. Note that JGroups SPI implementation uses multiplexer (re-using the same channel) since 2.0.0.

Configuration

The following configuration parameters can be used to configure GridJgroupsCommunicationSpi
Up to version 1.6.1 configuration looks as following:

Setter Method Description Optional Default
setConfigurationFile(String) Javadoc Sets either absolute or relative to GridGain home path to JGroups XML configuration file. Yes ${GRIDGAIN_HOME}/config/jgroups/communication/jgroups.xml specified by GridJgroupsCommunicationSpi.DFLT_CONFIG_FILE Javadoc
setGroupName(String) Javadoc Sets JGroups group name. In order to communicate with each other, nodes must have the same group name. Yes grid.comm.jgroups.channel specified by GridJgroupsCommunicationSpi.DFLT_GRP_NAME Javadoc
setSendTimeout(long) Javadoc Sets time limit in milliseconds to wait for message acknowledgements from remote nodes. Yes 10000 milliseconds specified by GridJgroupsCommunicationSpi.DFLT_SEND_TIMEOUT Javadoc

Starting from version 2.0 we added some new parameters as we use JGroups multiplexer.

Setter Method Description Optional Default
setConfigurationFile(String) Javadoc Sets either absolute or relative to GridGain home path to JGroups XML configuration file. Yes ${GRIDGAIN_HOME}/config/jgroups/multicast/jgroups.xml specified by GridJgroupsCommunicationSpi.DFLT_CONFIG_FILE Javadoc
setGroupName(String) Javadoc Sets JGroups group name. In order to communicate with each other, nodes must have the same group name. Yes grid.comm.jgroups specified by GridJgroupsCommunicationSpi.DFLT_GRP_NAME Javadoc
setStackName(String) Javadoc Sets JGroups stack name. In order to use multiplexor over the same channel SPIs must have the same stack name. Stack name is a name of configuration in the configuration file. Yes grid.jgroups.stack specified by GridJgroupsCommunicationSpi.DFLT_STACK_NAME Javadoc
setSendTimeout(long) Javadoc Sets time limit in milliseconds to wait for message acknowledgements from remote nodes. Yes 10000 milliseconds specified by GridJgroupsCommunicationSpi.DFLT_SEND_TIMEOUT Javadoc
IPv4 vs IPv6

Note, if you have an OS with IPv6 enabled, Java applications may try to route IP multicast traffic over IPv6. Use "-Djava.net.preferIPv4Stack=true" system property at VM startup to prevent this. You may also wish to specify local bind address in JGroups configuration file to make sure that JGroups binds to correct network interface.

JGroups and Linux

We had a number of issues with configuring JGroups on Linux (mostly with getting IP multicast to work). We highly recommend to consult JGroups documentation. We also advise you to Google search for Java IP-multicast troubleshooting on the internet as many IP-multicast intensive systems have good configuration and optimization documentations.

Examples

GridJgroupsCommunicationSpi needs to be explicitely configured to override default TCP communication SPI.

GridJgroupsCommunicationSpi commSpi = new GridJgroupsCommunicationSpi();

// Override default JGroups configuration file.
commSpi.setConfigurationFile("/my/config/path/jgroups.xml");

GridConfigurationAdapter cfg = new GridConfigurationAdapter();

// Override default communication SPI.
cfg.setCommunicationSpi(commSpi);

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

or from Spring configuration file

<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfigurationAdapter" singleton="true">
        ...
        <property name="communicationSpi">
            <bean class="org.gridgain.grid.spi.communication.jgroups.GridJgroupsCommunicationSpi">
                <property name="configurationFile" value="/my/config/path/jgroups.xml"/>
            </bean>
        </property>
        ...
</bean>


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