Package com.netflix.eureka.cluster
Class PeerEurekaNodes
- java.lang.Object
-
- com.netflix.eureka.cluster.PeerEurekaNodes
-
@Singleton public abstract class PeerEurekaNodes extends java.lang.ObjectHelper class to manage lifecycle of a collection ofPeerEurekaNodes.
-
-
Field Summary
Fields Modifier and Type Field Description protected com.netflix.discovery.EurekaClientConfigclientConfigprotected PeerAwareInstanceRegistryregistryprotected ServerCodecsserverCodecsprotected EurekaServerConfigserverConfig
-
Constructor Summary
Constructors Constructor Description PeerEurekaNodes(PeerAwareInstanceRegistry registry, EurekaServerConfig serverConfig, com.netflix.discovery.EurekaClientConfig clientConfig, ServerCodecs serverCodecs, com.netflix.appinfo.ApplicationInfoManager applicationInfoManager)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract PeerEurekaNodecreatePeerEurekaNode(java.lang.String peerEurekaNodeUrl)intgetMinNumberOfAvailablePeers()java.util.List<PeerEurekaNode>getPeerEurekaNodes()java.util.List<PeerEurekaNode>getPeerNodesView()static java.lang.StringhostFromUrl(java.lang.String url)booleanisInstanceURL(java.lang.String url, com.netflix.appinfo.InstanceInfo instance)Checks if the given service url matches the supplied instancestatic booleanisThisMe(java.lang.String url)Deprecated.2016-06-27 use instance version ofisThisMyUrl(String)Checks if the given service url contains the current host which is trying to replicate.booleanisThisMyUrl(java.lang.String url)Checks if the given service url contains the current host which is trying to replicate.protected java.util.List<java.lang.String>resolvePeerUrls()Resolve peer URLs.voidshutdown()voidstart()protected voidupdatePeerEurekaNodes(java.util.List<java.lang.String> newPeerUrls)Given new set of replica URLs, destroyPeerEurekaNodes no longer available, and create new ones.
-
-
-
Field Detail
-
registry
protected final PeerAwareInstanceRegistry registry
-
serverConfig
protected final EurekaServerConfig serverConfig
-
clientConfig
protected final com.netflix.discovery.EurekaClientConfig clientConfig
-
serverCodecs
protected final ServerCodecs serverCodecs
-
-
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, destroyPeerEurekaNodes 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 ofisThisMyUrl(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)
-
-