Class PeerEurekaNodes


  • @Singleton
    public abstract class PeerEurekaNodes
    extends java.lang.Object
    Helper class to manage lifecycle of a collection of PeerEurekaNodes.
    • Constructor Detail

      • PeerEurekaNodes

        @Inject
        public PeerEurekaNodes​(PeerAwareInstanceRegistry registry,
                               EurekaServerConfig serverConfig,
                               com.netflix.discovery.EurekaClientConfig clientConfig,
                               ServerCodecs serverCodecs,
                               com.netflix.appinfo.ApplicationInfoManager applicationInfoManager)
    • Method Detail

      • getPeerNodesView

        public java.util.List<PeerEurekaNode> getPeerNodesView()
      • getPeerEurekaNodes

        public java.util.List<PeerEurekaNode> getPeerEurekaNodes()
      • getMinNumberOfAvailablePeers

        public int getMinNumberOfAvailablePeers()
      • start

        public void start()
      • shutdown

        public void shutdown()
      • resolvePeerUrls

        protected java.util.List<java.lang.String> resolvePeerUrls()
        Resolve peer URLs.
        Returns:
        peer URLs with node's own URL filtered out
      • updatePeerEurekaNodes

        protected void updatePeerEurekaNodes​(java.util.List<java.lang.String> newPeerUrls)
        Given new set of replica URLs, destroy PeerEurekaNodes no longer available, and create new ones.
        Parameters:
        newPeerUrls - peer node URLs; this collection should have local node's URL filtered out
      • createPeerEurekaNode

        protected abstract PeerEurekaNode createPeerEurekaNode​(java.lang.String peerEurekaNodeUrl)
      • isThisMe

        public static boolean isThisMe​(java.lang.String url)
        Deprecated.
        2016-06-27 use instance version of isThisMyUrl(String) Checks if the given service url contains the current host which is trying to replicate. Only after the EIP binding is done the host has a chance to identify itself in the list of replica nodes and needs to take itself out of replication traffic.
        Parameters:
        url - the service url of the replica node that the check is made.
        Returns:
        true, if the url represents the current node which is trying to replicate, false otherwise.
      • isThisMyUrl

        public boolean isThisMyUrl​(java.lang.String url)
        Checks if the given service url contains the current host which is trying to replicate. Only after the EIP binding is done the host has a chance to identify itself in the list of replica nodes and needs to take itself out of replication traffic.
        Parameters:
        url - the service url of the replica node that the check is made.
        Returns:
        true, if the url represents the current node which is trying to replicate, false otherwise.
      • isInstanceURL

        public boolean isInstanceURL​(java.lang.String url,
                                     com.netflix.appinfo.InstanceInfo instance)
        Checks if the given service url matches the supplied instance
        Parameters:
        url - the service url of the replica node that the check is made.
        instance - the instance to check the service url against
        Returns:
        true, if the url represents the supplied instance, false otherwise.
      • hostFromUrl

        public static java.lang.String hostFromUrl​(java.lang.String url)