public class ClusterGroupAdapter extends Object implements ClusterGroupEx, Externalizable
Modifier and Type | Field and Description |
---|---|
protected GridKernalContext |
ctx
Kernal context.
|
protected IgnitePredicate<ClusterNode> |
p
Cluster group predicate.
|
protected UUID |
subjId
Subject ID.
|
Modifier | Constructor and Description |
---|---|
|
ClusterGroupAdapter()
Required by
Externalizable . |
protected |
ClusterGroupAdapter(GridKernalContext ctx,
UUID subjId,
IgnitePredicate<ClusterNode> p) |
protected |
ClusterGroupAdapter(GridKernalContext ctx,
UUID subjId,
Set<UUID> ids) |
Modifier and Type | Method and Description |
---|---|
IgniteCompute |
compute() |
IgniteEvents |
events() |
ExecutorService |
executorService() |
ClusterGroup |
forAttribute(String name,
Object val)
Creates a new cluster group for nodes containing given name and value
specified in user attributes.
|
ClusterGroup |
forCacheNodes(String cacheName)
Creates a cluster group for all nodes that have cache with specified name, either in client or server modes.
|
ClusterGroup |
forCacheNodes(String cacheName,
boolean affNodes,
boolean nearNodes,
boolean clientNodes) |
ClusterGroup |
forClientNodes(String cacheName)
Creates a cluster group for all client nodes that access cache with the specified name.
|
ClusterGroup |
forClients()
Creates a cluster group of nodes started in client mode.
|
ClusterGroup |
forDaemons()
Gets a cluster group consisting from the daemon nodes.
|
ClusterGroup |
forDataNodes(String cacheName)
Creates a cluster group for all data nodes that have the cache with the specified name running.
|
ClusterGroup |
forHost(ClusterNode node)
Gets cluster group consisting from the nodes in this cluster group residing on the
same host as the given node.
|
ClusterGroup |
forHost(String host,
String... hosts)
Gets cluster group consisting from the nodes running on the hosts specified.
|
ClusterGroup |
forIgfsMetadataDataNodes(String igfsName,
String metaCacheName)
Create projection for IGFS server nodes.
|
ClusterGroup |
forNode(ClusterNode node,
ClusterNode... nodes)
Creates a cluster group for the given node.
|
ClusterGroup |
forNodeId(UUID id,
UUID... ids)
Creates a cluster group for a node with the specified ID.
|
ClusterGroup |
forNodeIds(Collection<UUID> ids)
Creates a cluster group over nodes with specified node IDs.
|
ClusterGroup |
forNodes(Collection<? extends ClusterNode> nodes)
Creates a cluster group over a given set of nodes.
|
ClusterGroup |
forOldest()
Creates a cluster group with one oldest node from the current cluster group.
|
ClusterGroup |
forOthers(ClusterGroup grp)
Creates a cluster group for nodes not included into the given cluster group.
|
ClusterGroup |
forOthers(ClusterNode node,
ClusterNode... nodes)
Creates a cluster group for nodes other than the given nodes.
|
ClusterGroup |
forPredicate(IgnitePredicate<ClusterNode> p)
Creates a new cluster group which includes all nodes that pass the given predicate filter.
|
ClusterGroup |
forRandom()
Creates a cluster group with one random node from the current cluster group.
|
ClusterGroup |
forRemotes()
Gets cluster group consisting from the nodes in this cluster group excluding the local node.
|
ClusterGroup |
forServers()
Creates a cluster group of nodes started in server mode.
|
ClusterGroupEx |
forSubjectId(UUID subjId)
Creates projection for specified subject ID.
|
ClusterGroup |
forYoungest()
Creates a cluster group with one youngest node in the current cluster group.
|
protected void |
guard()
ctx.gateway().readLock()
|
Collection<String> |
hostNames()
Gets the read-only collection of hostnames in this cluster group.
|
Ignite |
ignite()
Gets instance of grid.
|
IgniteMessaging |
message() |
ClusterMetrics |
metrics()
Gets a metrics snapshot for this cluster group.
|
ClusterNode |
node()
Gets first node from the list of nodes in this cluster group.
|
ClusterNode |
node(UUID id)
Gets a node for given ID from this cluster group.
|
Collection<ClusterNode> |
nodes()
Gets the read-only collection of nodes in this cluster group.
|
IgnitePredicate<ClusterNode> |
predicate()
Gets predicate that defines a subset of nodes for this cluster group.
|
void |
readExternal(ObjectInput in) |
protected Object |
readResolve()
Reconstructs object on unmarshalling.
|
IgniteServices |
services() |
void |
setKernalContext(GridKernalContext ctx)
Sets kernal context.
|
protected void |
unguard()
ctx.gateway().readUnlock()
|
void |
writeExternal(ObjectOutput out) |
protected transient GridKernalContext ctx
protected UUID subjId
protected IgnitePredicate<ClusterNode> p
public ClusterGroupAdapter()
Externalizable
.protected ClusterGroupAdapter(@Nullable GridKernalContext ctx, @Nullable UUID subjId, @Nullable IgnitePredicate<ClusterNode> p)
subjId
- Subject ID.ctx
- Kernal context.p
- Predicate.protected ClusterGroupAdapter(@Nullable GridKernalContext ctx, @Nullable UUID subjId, Set<UUID> ids)
ctx
- Kernal context.subjId
- Subject ID.ids
- Node IDs.protected void guard()
protected void unguard()
public void setKernalContext(GridKernalContext ctx)
ctx
- Kernal context to set.public final Ignite ignite()
ignite
in interface ClusterGroup
public final IgniteCompute compute()
IgniteCompute
for this cluster group.public final IgniteMessaging message()
IgniteMessaging
for this cluster group.public final IgniteEvents events()
IgniteEvents
for this cluster group.public IgniteServices services()
IgniteServices
for this cluster group.public ExecutorService executorService()
ExecutorService
for this cluster group.public final ClusterMetrics metrics()
metrics
in interface ClusterGroup
public Collection<ClusterNode> nodes()
nodes
in interface ClusterGroup
public Collection<String> hostNames()
hostNames
in interface ClusterGroup
public final ClusterNode node(UUID id)
node
in interface ClusterGroup
id
- Node ID.null
, if such node does not exist.public ClusterNode node()
node
in interface ClusterGroup
null
if the cluster group is empty.public IgnitePredicate<ClusterNode> predicate()
predicate
in interface ClusterGroup
public ClusterGroup forPredicate(IgnitePredicate<ClusterNode> p)
forPredicate
in interface ClusterGroup
p
- Predicate filter for nodes to include into the cluster group.public final ClusterGroup forAttribute(String name, @Nullable Object val)
User attributes for every node are optional and can be specified in
grid node configuration. See IgniteConfiguration.getUserAttributes()
for more information.
forAttribute
in interface ClusterGroup
name
- Name of the attribute.val
- Optional attribute value to match.public ClusterGroup forServers()
forServers
in interface ClusterGroup
Ignition.setClientMode(boolean)
,
IgniteConfiguration.setClientMode(boolean)
public ClusterGroup forClients()
forClients
in interface ClusterGroup
Ignition.setClientMode(boolean)
,
IgniteConfiguration.setClientMode(boolean)
public final ClusterGroup forNode(ClusterNode node, ClusterNode... nodes)
forNode
in interface ClusterGroup
node
- Node to create cluster group for.nodes
- Optional additional nodes to include into the cluster group.public final ClusterGroup forNodes(Collection<? extends ClusterNode> nodes)
forNodes
in interface ClusterGroup
nodes
- Collection of nodes to create the cluster group from.public final ClusterGroup forNodeId(UUID id, UUID... ids)
forNodeId
in interface ClusterGroup
id
- Node ID to get the cluster group for.ids
- Optional additional node IDs to include into the cluster group.public final ClusterGroup forNodeIds(Collection<UUID> ids)
forNodeIds
in interface ClusterGroup
ids
- Collection of node IDs.public final ClusterGroup forOthers(ClusterNode node, ClusterNode... nodes)
forOthers
in interface ClusterGroup
node
- Node to exclude from the new cluster group.nodes
- Optional additional nodes to exclude from the cluster group.public ClusterGroup forOthers(ClusterGroup grp)
forOthers
in interface ClusterGroup
grp
- Cluster group to exclude from the new cluster group.public final ClusterGroup forRemotes()
forRemotes
in interface ClusterGroup
public final ClusterGroup forCacheNodes(String cacheName)
forCacheNodes
in interface ClusterGroup
cacheName
- Cache name.public final ClusterGroup forDataNodes(String cacheName)
forDataNodes
in interface ClusterGroup
cacheName
- Cache name.public final ClusterGroup forClientNodes(String cacheName)
forClientNodes
in interface ClusterGroup
cacheName
- Cache name.public ClusterGroup forCacheNodes(String cacheName, boolean affNodes, boolean nearNodes, boolean clientNodes)
forCacheNodes
in interface ClusterGroupEx
cacheName
- Cache name.affNodes
- Flag to include affinity nodes.nearNodes
- Flag to include near nodes.clientNodes
- Flag to include client nodes.public ClusterGroup forIgfsMetadataDataNodes(String igfsName, String metaCacheName)
forIgfsMetadataDataNodes
in interface ClusterGroupEx
igfsName
- IGFS name.metaCacheName
- Metadata cache name.public final ClusterGroup forHost(ClusterNode node)
forHost
in interface ClusterGroup
node
- Node to select the host for.public final ClusterGroup forHost(String host, String... hosts)
forHost
in interface ClusterGroup
host
- Host name to get nodes to put in clusterhosts
- Host names to get nodes to put in cluster.public final 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 cluster group. 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 the "normal" topology, so that it won't participate in the task execution or in-memory data grid storage.
forDaemons
in interface ClusterGroup
public final ClusterGroup forRandom()
forRandom
in interface ClusterGroup
public ClusterGroup forOldest()
Use ClusterGroup.node()
method to get the oldest node.
forOldest
in interface ClusterGroup
public ClusterGroup forYoungest()
forYoungest
in interface ClusterGroup
public ClusterGroupEx forSubjectId(UUID subjId)
forSubjectId
in interface ClusterGroupEx
subjId
- Subject ID.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
protected Object readResolve() throws ObjectStreamException
ObjectStreamException
- Thrown in case of unmarshalling error.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017