Class GridClientTopology


  • public class GridClientTopology
    extends Object
    Client topology cache.
    • Constructor Detail

      • GridClientTopology

        public GridClientTopology​(GridClientConfiguration cfg)
        Creates topology instance.
        Parameters:
        cfg - Client configuration.
    • Method Detail

      • addTopologyListener

        public void addTopologyListener​(GridClientTopologyListener lsnr)
        Adds topology listener.
        Parameters:
        lsnr - Topology listener.
      • removeTopologyListener

        public void removeTopologyListener​(GridClientTopologyListener lsnr)
        Removes topology listener.
        Parameters:
        lsnr - Topology listener.
      • updateNode

        public GridClientNode updateNode​(GridClientNodeImpl node)
        Updates topology if cache enabled. If cache is disabled, returns original node.
        Parameters:
        node - Converted rest server response.
        Returns:
        Node in topology.
      • updateTopology

        public Collection<? extends GridClientNode> updateTopology​(Collection<GridClientNodeImpl> nodeList)
        Updates (if cache is enabled) the whole topology. If cache is disabled, original collection is returned.
        Parameters:
        nodeList - Converted rest server response.
        Returns:
        Topology nodes.
      • fail

        public void fail​(GridClientException cause)
        Marks topology as failed. After this method called all accessors will throw exception until a next successful update.
        Parameters:
        cause - Exception caused the failure.
      • nodeFailed

        public void nodeFailed​(UUID nodeId)
        Updates topology when node that is expected to be in topology fails.
        Parameters:
        nodeId - Node id for which node failed to be obtained.
      • nodes

        public Collection<GridClientNode> nodes​(Iterable<UUID> ids)
                                         throws GridClientException
        Gets a collection of nodes from last saved topology snapshot by their ids.
        Parameters:
        ids - Collection of ids for which nodes should be retrieved..
        Returns:
        Collection of nodes that are in topology.
        Throws:
        GridClientException - If topology is failed and no nodes available.
      • failed

        public boolean failed()
        Returns:
        Whether topology is failed.
      • shutdown

        public void shutdown()
        Shutdowns executor service that performs listener notification.