Class GridClientClusterStateImpl

    • Method Detail

      • withReconnectHandling

        protected <R> GridClientFuture<R> withReconnectHandling​(org.apache.ignite.internal.client.impl.GridClientAbstractProjection.ClientProjectionClosure<R> c)
        This method executes request to a communication layer and handles connection error, if it occurs. In case of communication exception client instance is notified and new instance of client is created. If none of the grid servers can be reached, an exception is thrown.
        Type Parameters:
        R - Result future type.
        Parameters:
        c - Closure to be executed.
        Returns:
        Future returned by closure.
      • withReconnectHandling

        protected <R> GridClientFuture<R> withReconnectHandling​(org.apache.ignite.internal.client.impl.GridClientAbstractProjection.ClientProjectionClosure<R> c,
                                                                String cacheName,
                                                                @Nullable
                                                                @Nullable Object affKey)
        This method executes request to a communication layer and handles connection error, if it occurs. Server is picked up according to the projection affinity and key given. Connection will be made with the node on which key is cached. In case of communication exception client instance is notified and new instance of client is created. If none of servers can be reached, an exception is thrown.
        Type Parameters:
        R - Type of result in future.
        Parameters:
        c - Closure to be executed.
        cacheName - Cache name for which mapped node will be calculated.
        affKey - Affinity key.
        Returns:
        Operation future.
      • checkNodeAlive

        protected boolean checkNodeAlive​(UUID nodeId)
                                  throws GridClientException,
                                         InterruptedException
        Tries to refresh node on every possible connection in topology.
        Parameters:
        nodeId - Node id to check.
        Returns:
        True if response was received, false if either null response received or no nodes can be contacted at all.
        Throws:
        GridClientException - If failed to refresh topology or if client was closed manually.
        InterruptedException - If interrupted.
      • projectionNodes

        public Collection<? extends GridClientNode> projectionNodes()
                                                             throws GridClientException
        Gets most recently refreshed topology. If this compute instance is a projection, then only nodes that satisfy projection criteria will be returned.
        Returns:
        Most recently refreshed topology.
        Throws:
        GridClientException - If failed to refresh topology.
      • projectionNodes

        protected Collection<? extends GridClientNode> projectionNodes​(@Nullable
                                                                       @Nullable GridClientPredicate<GridClientNode> pred)
                                                                throws GridClientException
        Gets most recently refreshed topology. If this compute instance is a projection, then only nodes that satisfy projection criteria will be returned.
        Parameters:
        pred - Predicate to additionally filter projection nodes, if null just return projection.
        Returns:
        Most recently refreshed topology.
        Throws:
        GridClientException - If failed to refresh topology.
      • createProjection

        protected T createProjection​(@Nullable
                                     @Nullable Collection<GridClientNode> nodes,
                                     @Nullable
                                     @Nullable GridClientPredicate<? super GridClientNode> filter,
                                     @Nullable
                                     @Nullable GridClientLoadBalancer balancer,
                                     org.apache.ignite.internal.client.impl.GridClientAbstractProjection.ProjectionFactory<T> factory)
                              throws GridClientException
        Creates a sub-projection for current projection.
        Parameters:
        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.
        Returns:
        Created projection.
        Throws:
        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.