com.netflix.discovery.shared
Class Applications

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

@Serializer(value="com.netflix.discovery.converters.EntityBodyConverter")
public class Applications
extends java.lang.Object

The class that wraps all the registry information returned by eureka server.

Note that the registry information is fetched from eureka server as specified in EurekaClientConfig.getRegistryFetchIntervalSeconds().Once the information is fetched it is shuffled and also filtered for instances with InstanceInfo.InstanceStatus.UP status as specified by the configuration EurekaClientConfig.shouldFilterOnlyUpInstances().


Constructor Summary
Applications()
           
Applications(java.util.List<Application> apps)
           
 
Method Summary
 void addApplication(Application app)
          Add the application to the list.
 java.lang.String getAppsHashCode()
          Used by the eureka server.
 java.util.List<InstanceInfo> getInstancesBySecureVirtualHostName(java.lang.String secureVirtualHostName)
          Gets the list of secure instances associated to a virtual host name.
 java.util.List<InstanceInfo> getInstancesByVirtualHostName(java.lang.String virtualHostName)
          Gets the list of instances associated to a virtual host name.
 java.util.concurrent.atomic.AtomicLong getNextIndex(java.lang.String virtualHostname, boolean secure)
          Gets the next round-robin index for the given virtual host name.
 java.lang.String getReconcileHashCode()
          Gets the hash code for this applications instance.
static java.lang.String getReconcileHashCode(java.util.TreeMap<java.lang.String,java.util.concurrent.atomic.AtomicInteger> instanceCountMap)
           
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getReconcileMapDiff(Applications apps)
          Gets the exact difference between this applications instance and another one.
 java.util.List<Application> getRegisteredApplications()
          Gets the list of all registered applications from eureka.
 Application getRegisteredApplications(java.lang.String appName)
          Gets the list of all registered applications for the given application name.
 java.lang.Long getVersion()
          Deprecated. 
 void populateInstanceCountMap(java.util.TreeMap<java.lang.String,java.util.concurrent.atomic.AtomicInteger> instanceCountMap)
           
 void setAppsHashCode(java.lang.String hashCode)
          Used by the eureka server.
 void setVersion(java.lang.Long version)
          Deprecated. 
 void shuffleAndIndexInstances(java.util.Map<java.lang.String,Applications> remoteRegionsRegistry, EurekaClientConfig clientConfig, InstanceRegionChecker instanceRegionChecker)
           
 void shuffleInstances(boolean filterUpInstances)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Applications

public Applications()

Applications

public Applications(java.util.List<Application> apps)
Method Detail

addApplication

public void addApplication(Application app)
Add the application to the list.

Parameters:
app - the application to be added.

getRegisteredApplications

public java.util.List<Application> getRegisteredApplications()
Gets the list of all registered applications from eureka.

Returns:
list containing all applications registered with eureka.

getRegisteredApplications

public Application getRegisteredApplications(java.lang.String appName)
Gets the list of all registered applications for the given application name.

Parameters:
appName - the application name for which the result need to be fetched.
Returns:
the list of registered applications for the given application name.

getInstancesByVirtualHostName

public java.util.List<InstanceInfo> getInstancesByVirtualHostName(java.lang.String virtualHostName)
Gets the list of instances associated to a virtual host name.

Parameters:
virtualHostName - the virtual hostname for which the instances need to be returned.
Returns:
list of instances.

getInstancesBySecureVirtualHostName

public java.util.List<InstanceInfo> getInstancesBySecureVirtualHostName(java.lang.String secureVirtualHostName)
Gets the list of secure instances associated to a virtual host name.

Parameters:
secureVirtualHostName - the virtual hostname for which the secure instances need to be returned.
Returns:
list of instances.

setVersion

@Deprecated
public void setVersion(java.lang.Long version)
Deprecated. 


getVersion

@Deprecated
public java.lang.Long getVersion()
Deprecated. 


setAppsHashCode

public void setAppsHashCode(java.lang.String hashCode)
Used by the eureka server. Not for external use.

Parameters:
hashCode -

getAppsHashCode

public java.lang.String getAppsHashCode()
Used by the eureka server. Not for external use.

Returns:
the string indicating the hashcode based on the applications stored.

getReconcileHashCode

public java.lang.String getReconcileHashCode()
Gets the hash code for this applications instance. Used for comparison of instances between eureka server and eureka client.

Returns:
the internal hash code representation indicating the information about the instances.

populateInstanceCountMap

public void populateInstanceCountMap(java.util.TreeMap<java.lang.String,java.util.concurrent.atomic.AtomicInteger> instanceCountMap)

getReconcileHashCode

public static java.lang.String getReconcileHashCode(java.util.TreeMap<java.lang.String,java.util.concurrent.atomic.AtomicInteger> instanceCountMap)

getReconcileMapDiff

public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getReconcileMapDiff(Applications apps)
Gets the exact difference between this applications instance and another one.

Parameters:
apps - the applications for which to compare this one.
Returns:
a map containing the differences between the two.

shuffleInstances

public void shuffleInstances(boolean filterUpInstances)

shuffleAndIndexInstances

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

getNextIndex

public java.util.concurrent.atomic.AtomicLong getNextIndex(java.lang.String virtualHostname,
                                                           boolean secure)
Gets the next round-robin index for the given virtual host name. This index is reset after every registry fetch cycle.

Parameters:
virtualHostname - the virtual host name.
secure - indicates whether it is a secure request or a non-secure request.
Returns:
AtomicLong value representing the next round-robin index.