public class GridClientClusterStateImpl extends Object implements GridClientClusterState
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
GridClientAbstractProjection.ClientProjectionClosure<R>
Closure to execute reconnect-handling code.
|
protected static interface |
GridClientAbstractProjection.ProjectionFactory<X extends org.apache.ignite.internal.client.impl.GridClientAbstractProjection>
Factory for new projection creation.
|
| Modifier and Type | Field and Description |
|---|---|
protected GridClientLoadBalancer |
balancer
Balancer to be used in this projection.
|
protected GridClientImpl |
client
Client instance.
|
protected GridClientPredicate<? super GridClientNode> |
filter
Node filter to be applied for this projection.
|
protected Collection<GridClientNode> |
nodes
List of nodes included in this projection.
|
| Constructor and Description |
|---|
GridClientClusterStateImpl(GridClientImpl client,
Collection<GridClientNode> nodes,
GridClientPredicate<? super GridClientNode> filter,
GridClientLoadBalancer balancer)
Creates projection with specified client.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
active() |
void |
active(boolean active) |
protected boolean |
checkNodeAlive(UUID nodeId)
Tries to refresh node on every possible connection in topology.
|
String |
clusterName()
Get the cluster name.
|
protected T |
createProjection(@Nullable Collection<GridClientNode> nodes,
@Nullable GridClientPredicate<? super GridClientNode> filter,
@Nullable GridClientLoadBalancer balancer,
GridClientAbstractProjection.ProjectionFactory<T> factory)
Creates a sub-projection for current projection.
|
Collection<? extends GridClientNode> |
projectionNodes()
Gets most recently refreshed topology.
|
protected Collection<? extends GridClientNode> |
projectionNodes(@Nullable GridClientPredicate<GridClientNode> pred)
Gets most recently refreshed topology.
|
protected <R> GridClientFuture<R> |
withReconnectHandling(GridClientAbstractProjection.ClientProjectionClosure<R> c)
This method executes request to a communication layer and handles connection error, if it occurs.
|
protected <R> GridClientFuture<R> |
withReconnectHandling(GridClientAbstractProjection.ClientProjectionClosure<R> c,
String cacheName,
@Nullable Object affKey)
This method executes request to a communication layer and handles connection error, if it occurs.
|
protected Collection<GridClientNode> nodes
protected GridClientPredicate<? super GridClientNode> filter
protected GridClientLoadBalancer balancer
protected GridClientImpl client
public GridClientClusterStateImpl(GridClientImpl client, Collection<GridClientNode> nodes, GridClientPredicate<? super GridClientNode> filter, GridClientLoadBalancer balancer)
client - Client instance to use.nodes - Collections of nodes included in this projection.filter - Node filter to be applied.balancer - Balancer to use.public void active(boolean active)
throws GridClientException
active in interface GridClientClusterStateactive - True activate, False deactivate.GridClientExceptionpublic boolean active()
throws GridClientException
active in interface GridClientClusterStateBoolean - Current cluster state. True active, False inactive.GridClientExceptionpublic String clusterName() throws GridClientException
clusterName in interface GridClientClusterStateGridClientException - If the request to get the cluster name failed.protected <R> GridClientFuture<R> withReconnectHandling(GridClientAbstractProjection.ClientProjectionClosure<R> c)
R - Result future type.c - Closure to be executed.protected <R> GridClientFuture<R> withReconnectHandling(GridClientAbstractProjection.ClientProjectionClosure<R> c, String cacheName, @Nullable @Nullable Object affKey)
R - Type of result in future.c - Closure to be executed.cacheName - Cache name for which mapped node will be calculated.affKey - Affinity key.protected boolean checkNodeAlive(UUID nodeId) throws GridClientException, InterruptedException
nodeId - Node id to check.True if response was received, false if either null response received or
no nodes can be contacted at all.GridClientException - If failed to refresh topology or if client was closed manually.InterruptedException - If interrupted.public Collection<? extends GridClientNode> projectionNodes() throws GridClientException
GridClientException - If failed to refresh topology.protected Collection<? extends GridClientNode> projectionNodes(@Nullable @Nullable GridClientPredicate<GridClientNode> pred) throws GridClientException
pred - Predicate to additionally filter projection nodes,
if null just return projection.GridClientException - If failed to refresh topology.protected T createProjection(@Nullable
@Nullable Collection<GridClientNode> nodes,
@Nullable
@Nullable GridClientPredicate<? super GridClientNode> filter,
@Nullable
@Nullable GridClientLoadBalancer balancer,
GridClientAbstractProjection.ProjectionFactory<T> factory)
throws GridClientException
nodes - Collection of nodes that sub-projection will be restricted to. If null,
created projection is dynamic and will take nodes from topology.filter - Filter to be applied to nodes in projection. If null - no filter applied.balancer - Balancer to use in projection. If null - inherit balancer from the current projection.factory - Factory to create new projection.GridClientException - If resulting projection is empty. Note that this exception may
only be thrown on case of static projections, i.e. where collection of nodes is not null.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.8.0 Release Date : February 27 2020