Dashboard > GridGain User Guide > Table Of Contents > Developers Guide > Topology SPI > GridAttributesTopologySpi
GridAttributesTopologySpi
Added by ghost, last edited by link on Jul 08, 2008  (view change)
Labels: 
(None)


Click on Javadoc link to open Javadoc documentation.

Package

org.gridgain.grid.spi.toplogy.basic Javadoc

Description

GridAttributesTopologySpi Javadoc provides topology SPI implementation based on node attributes. This implementation always returns all nodes (local and remote) that have attributes provided in configuration with given values. If no attributes were provided, all nodes, local and remote,
will be included into topology.

Configuration

The following configuration parameters can be used to configure GridAttributesTopologySpi Javadoc

Setter Method Description Optional Default
setAttributes(Map<String, Serializable>) Javadoc Sets attributes that all nodes should have, to be in topology. Yes No value

Examples

As any GridGain SPI, GridAttributesTopologySpi Javadoc can be configured either directly from code or from Spring configuration file. Here is an example of GridAttributesTopologySpi Javadoc configuration from code:

GridAttributesTopologySpi topSpi = new GridAttributesTopologySpi();

// Create attributes map.
Map<String, Serializable> attrs = new HashMap<String, Serializable>(1);

attrs.put("group", "myTask");

// Include nodes that have attribute with name "group" and value "myTask".
topSpi.setAttributes(attrs);

GridConfigurationAdapter cfg = new GridConfigurationAdapter();

// Override default topology SPI.
cfg.setTopologySpi(topSpi);

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

or from Spring configuration file

<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfigurationAdapter" singleton="true">
        ...
        <property name="topologySpi">
            <bean class="org.gridgain.grid.spi.topology.attributes.GridAttributesTopologySpi">
               <property name="attributes">
                    <map>
                        <entry key="group">
                            <value>myTask</value>
                        </entry>
                    </map>
                </property>
            </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