Package com.netflix.discovery.shared
Class Application
- java.lang.Object
-
- com.netflix.discovery.shared.Application
-
@Serializer("com.netflix.discovery.converters.EntityBodyConverter") public class Application extends java.lang.Object
The application class holds the list of instances for a particular application.
-
-
Constructor Summary
Constructors Constructor Description Application()Application(java.lang.String name)Application(java.lang.String name, java.util.List<InstanceInfo> instances)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInstance(InstanceInfo i)Add the given instance info the list.InstanceInfogetByInstanceId(java.lang.String id)Get the instance info that matches the given id.java.util.List<InstanceInfo>getInstances()Gets the list of instances associated with this particular application.java.util.List<InstanceInfo>getInstancesAsIsFromEureka()Gets the list of non-shuffled and non-filtered instances associated with this particular application.java.lang.StringgetName()Gets the name of the application.voidremoveInstance(InstanceInfo i)Remove the given instance info the list.voidsetName(java.lang.String name)Sets the name of the application.voidshuffleAndStoreInstances(boolean filterUpInstances)Shuffles the list of instances in the application and stores it for future retrievals.voidshuffleAndStoreInstances(java.util.Map<java.lang.String,Applications> remoteRegionsRegistry, EurekaClientConfig clientConfig, InstanceRegionChecker instanceRegionChecker)intsize()java.lang.StringtoString()
-
-
-
Constructor Detail
-
Application
public Application()
-
Application
public Application(java.lang.String name)
-
Application
public Application(java.lang.String name, java.util.List<InstanceInfo> instances)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
addInstance
public void addInstance(InstanceInfo i)
Add the given instance info the list.- Parameters:
i- the instance info object to be added.
-
removeInstance
public void removeInstance(InstanceInfo i)
Remove the given instance info the list.- Parameters:
i- the instance info object to be removed.
-
getInstances
public java.util.List<InstanceInfo> getInstances()
Gets the list of instances associated with this particular application.Note that the instances are always returned with random order after shuffling to avoid traffic to the same instances during startup. The shuffling always happens once after every fetch cycle as specified in
EurekaClientConfig.getRegistryFetchIntervalSeconds().- Returns:
- the list of shuffled instances associated with this application.
-
getInstancesAsIsFromEureka
public java.util.List<InstanceInfo> getInstancesAsIsFromEureka()
Gets the list of non-shuffled and non-filtered instances associated with this particular application.- Returns:
- list of non-shuffled and non-filtered instances associated with this particular application.
-
getByInstanceId
public InstanceInfo getByInstanceId(java.lang.String id)
Get the instance info that matches the given id.- Parameters:
id- the id for which the instance info needs to be returned.- Returns:
- the instance info object.
-
getName
public java.lang.String getName()
Gets the name of the application.- Returns:
- the name of the application.
-
setName
public void setName(java.lang.String name)
Sets the name of the application.- Parameters:
name- the name of the application.
-
size
public int size()
- Returns:
- the number of instances in this application
-
shuffleAndStoreInstances
public void shuffleAndStoreInstances(boolean filterUpInstances)
Shuffles the list of instances in the application and stores it for future retrievals.- Parameters:
filterUpInstances- indicates whether only the instances with statusInstanceInfo.InstanceStatus.UPneeds to be stored.
-
shuffleAndStoreInstances
public void shuffleAndStoreInstances(java.util.Map<java.lang.String,Applications> remoteRegionsRegistry, EurekaClientConfig clientConfig, InstanceRegionChecker instanceRegionChecker)
-
-