changes.
| | * [#Package] |
| | * [#Description] |
| | * [#Configuration] |
| | * [#Examples] |
| | |
| | {javadocnote} |
| | |
| | h2. Package |
| | *org.gridgain.grid.spi.toplogy.basic* ^[Javadoc|org/gridgain/grid/spi/topology/basic/package-summary.html@javadoc]^ |
| | |
| | h2. Description |
| | | {{GridAttributesTopologySpi}} {javadoc:spi/topology/basic/GridAttributesTopologySpi.html} provides topology SPI implementation based on nodes 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, |
| | | {{GridAttributesTopologySpi}} {javadoc:spi/topology/basic/GridAttributesTopologySpi.html} provides topology SPI implementation based on [node attributes|GridNode Interface#-GridNodeAttributes]. 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. |
| | |
| | h2. Configuration |
| | The following configuration parameters can be used to configure {{GridAttributesTopologySpi}} {javadoc:spi/topology/basic/GridAttributesTopologySpi.html} |
| | || Setter Method || Description || Optional || Default || |
| | | {{setAttributes(Map<String, Serializable>)}} {javadoc:spi/topology/basic/GridAttributesTopologySpi.html#setAttributes(Map<String, Serializable>)} | Sets attributes that all nodes should have, to be in topology. | Yes | No value | |
| | |
| | h2. Examples |
| | As any GridGain SPI, {{GridAttributesTopologySpi}} {javadoc:spi/topology/basic/GridAttributesTopologySpi.html} can be configured either directly from code or from Spring configuration file. Here is an example of {{GridAttributesTopologySpi}} {javadoc:spi/topology/basic/GridAttributesTopologySpi.html} configuration from code: |
| | {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); |
| | {code} |
| | |
| | or from Spring configuration file |
| | |
| | {code:xml} |
| | <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> |
| | {code} |
| | |
| | {spring} |