public interface ClusterGroup
Ignite
interface itself also extends GridProjection
which makes
an instance of Ignite
a projection over all grid nodes.
'forXXX(...)'
methods will create a child grid projection
from existing projection. If you create a new projection from current one, then the resulting
projection will include a subset of nodes from current projection. The following code snippet
shows how to create and nest grid projections:
Grid g = Ignition.ignite(); // Projection over remote nodes. GridProjection remoteNodes = g.forRemotes(); // Projection over random remote node. GridProjection randomNode = remoteNodes.forRandom(); // Projection over all nodes with cache named "myCache" enabled. GridProjection cacheNodes = g.forCacheNodes("myCache"); // Projection over all nodes that have user attribute "group" set to value "worker". GridProjection workerNodes = g.forAttribute("group", "worker");
IgniteCompute
- functionality for executing tasks and closures over nodes in this projection.IgniteMessaging
- functionality for topic-based message exchange over nodes in this projection.IgniteEvents
- functionality for querying and listening to events on nodes in this projection.Modifier and Type | Method and Description |
---|---|
ClusterGroup |
forAttribute(String name,
String val)
Creates projection for nodes containing given name and value
specified in user attributes.
|
ClusterGroup |
forCacheNodes(String cacheName)
Creates projection for all nodes that have cache with specified name running.
|
ClusterGroup |
forClientNodes(String cacheName)
Creates projection for all nodes that have cache with specified name running and cache distribution mode is
CacheDistributionMode.CLIENT_ONLY or CacheDistributionMode.NEAR_ONLY . |
ClusterGroup |
forDaemons()
Gets projection consisting from the daemon nodes in this projection.
|
ClusterGroup |
forDataNodes(String cacheName)
Creates projection for all nodes that have cache with specified name running and cache distribution mode is
CacheDistributionMode.PARTITIONED_ONLY or CacheDistributionMode.NEAR_PARTITIONED . |
ClusterGroup |
forHost(ClusterNode node)
Gets grid projection consisting from the nodes in this projection residing on the
same host as given node.
|
ClusterGroup |
forNode(ClusterNode node,
ClusterNode... nodes)
Creates a grid projection for the given node.
|
ClusterGroup |
forNodeId(UUID id,
UUID... ids)
Creates a grid projection for a node with specified ID.
|
ClusterGroup |
forNodeIds(Collection<UUID> ids)
Creates a grid projection over nodes with specified node IDs.
|
ClusterGroup |
forNodes(Collection<? extends ClusterNode> nodes)
Creates a grid projection over a given set of nodes.
|
ClusterGroup |
forOldest()
Creates grid projection with one oldest node in the current projection.
|
ClusterGroup |
forOthers(ClusterGroup prj)
Creates a grid projection for nodes not included into given projection.
|
ClusterGroup |
forOthers(ClusterNode node,
ClusterNode... nodes)
Creates a grid projection for nodes other than given nodes.
|
ClusterGroup |
forPredicate(IgnitePredicate<ClusterNode> p)
Creates a grid projection which includes all nodes that pass the given predicate filter.
|
ClusterGroup |
forRandom()
Creates grid projection with one random node from current projection.
|
ClusterGroup |
forRemotes()
Gets grid projection consisting from the nodes in this projection excluding the local node.
|
ClusterGroup |
forStreamer(String streamerName,
String... streamerNames)
Creates projection for all nodes that have streamer with specified name running.
|
ClusterGroup |
forYoungest()
Creates grid projection with one youngest node in the current projection.
|
Ignite |
ignite()
Gets instance of grid.
|
ClusterMetrics |
metrics()
Gets a metrics snapshot for this projection.
|
ClusterNode |
node()
Gets first node from the list of nodes in this projection.
|
ClusterNode |
node(UUID nid)
Gets a node for given ID from this grid projection.
|
Collection<ClusterNode> |
nodes()
Gets read-only collections of nodes in this projection.
|
IgnitePredicate<ClusterNode> |
predicate()
Gets predicate that defines a subset of nodes for this projection.
|
Ignite ignite()
ClusterGroup forNodes(Collection<? extends ClusterNode> nodes)
nodes
- Collection of nodes to create a projection from.ClusterGroup forNode(ClusterNode node, ClusterNode... nodes)
node
- Node to get projection for.nodes
- Optional additional nodes to include into projection.ClusterGroup forOthers(ClusterNode node, ClusterNode... nodes)
node
- Node to exclude from new grid projection.nodes
- Optional additional nodes to exclude from projection.ClusterGroup forOthers(ClusterGroup prj)
prj
- Projection to exclude from new grid projection.ClusterGroup forNodeIds(Collection<UUID> ids)
ids
- Collection of node IDs.ClusterGroup forNodeId(UUID id, UUID... ids)
id
- Node ID to get projection for.ids
- Optional additional node IDs to include into projection.ClusterGroup forPredicate(IgnitePredicate<ClusterNode> p)
p
- Predicate filter for nodes to include into this projection.ClusterGroup forAttribute(String name, @Nullable String val)
User attributes for every node are optional and can be specified in
grid node configuration. See IgniteConfiguration.getUserAttributes()
for more information.
name
- Name of the attribute.val
- Optional attribute value to match.ClusterGroup forCacheNodes(String cacheName)
cacheName
- Cache name.ClusterGroup forDataNodes(String cacheName)
CacheDistributionMode.PARTITIONED_ONLY
or CacheDistributionMode.NEAR_PARTITIONED
.cacheName
- Cache name.CacheConfiguration.getDistributionMode()
ClusterGroup forClientNodes(String cacheName)
CacheDistributionMode.CLIENT_ONLY
or CacheDistributionMode.NEAR_ONLY
.cacheName
- Cache name.CacheConfiguration.getDistributionMode()
ClusterGroup forStreamer(String streamerName, @Nullable String... streamerNames)
streamerName
- Streamer name.streamerNames
- Optional additional streamer names to include into projection.ClusterGroup forRemotes()
ClusterGroup forHost(ClusterNode node)
node
- Node residing on the host for which projection is created.ClusterGroup forDaemons()
Daemon nodes are the usual grid nodes that participate in topology but not visible on the main APIs, i.e. they are not part of any projections. The only way to see daemon nodes is to use this method.
Daemon nodes are used primarily for management and monitoring functionality that is build on Ignite and needs to participate in the topology but also needs to be excluded from "normal" topology so that it won't participate in task execution or in-memory data grid storage.
ClusterGroup forRandom()
ClusterGroup forOldest()
ClusterGroup forYoungest()
Collection<ClusterNode> nodes()
@Nullable ClusterNode node(UUID nid)
nid
- Node ID.null
if such node does not exist in this
projection.@Nullable ClusterNode node()
null
if projection is empty.IgnitePredicate<ClusterNode> predicate()
ClusterMetrics metrics() throws IgniteException
IgniteException
- If projection is empty.
Follow @ApacheIgnite
Apache Ignite Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015