com.netflix.discovery.shared
Class Application

java.lang.Object
  extended by com.netflix.discovery.shared.Application

@Serializer(value="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
Application()
           
Application(java.lang.String name)
           
 
Method Summary
 void addInstance(InstanceInfo i)
          Add the given instance info the list.
 InstanceInfo getByInstanceId(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.String getName()
          Gets the name of the application.
 void removeInstance(InstanceInfo i)
          Remove the given instance info the list.
 void setName(java.lang.String name)
          Sets the name of the application.
 void shuffleAndStoreInstances(boolean filterUpInstances)
          Shuffles the list of instances in the application and stores it for future retrievals.
 void shuffleAndStoreInstances(java.util.Map<java.lang.String,Applications> remoteRegionsRegistry, EurekaClientConfig clientConfig, InstanceRegionChecker instanceRegionChecker)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Application

public Application()

Application

public Application(java.lang.String name)
Method Detail

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.

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 status InstanceInfo.InstanceStatus.UP needs to be stored.

shuffleAndStoreInstances

public void shuffleAndStoreInstances(java.util.Map<java.lang.String,Applications> remoteRegionsRegistry,
                                     EurekaClientConfig clientConfig,
                                     InstanceRegionChecker instanceRegionChecker)