Class Applications

    • Constructor Detail

      • Applications

        public Applications()
        Create a new, empty Eureka application list.
      • Applications

        public Applications​(java.lang.String appsHashCode,
                            java.lang.Long versionDelta,
                            java.util.List<Application> registeredApplications)
        Note that appsHashCode and versionDelta key names are formatted in a custom/configurable way.
    • 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 registered application for the given application name.
        Parameters:
        appName - the application name for which the result need to be fetched.
        Returns:
        the registered application 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.
      • size

        public int size()
        Returns:
        a weakly consistent size of the number of instances in all the applications
      • 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 - the hash code to assign for this app collection
      • 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.Map<java.lang.String,​java.util.concurrent.atomic.AtomicInteger> instanceCountMap)
        Populates the provided instance count map. The instance count map is used as part of the general app list synchronization mechanism.
        Parameters:
        instanceCountMap - the map to populate
      • getReconcileHashCode

        public static java.lang.String getReconcileHashCode​(java.util.Map<java.lang.String,​java.util.concurrent.atomic.AtomicInteger> instanceCountMap)
        Gets the reconciliation hashcode. The hashcode is used to determine whether the applications list has changed since the last time it was acquired.
        Parameters:
        instanceCountMap - the instance count map to use for generating the hash
        Returns:
        the hash code for this instance
      • shuffleInstances

        public void shuffleInstances​(boolean filterUpInstances)
        Shuffles the provided instances so that they will not always be returned in the same order.
        Parameters:
        filterUpInstances - whether to return only UP instances
      • shuffleAndIndexInstances

        public void shuffleAndIndexInstances​(java.util.Map<java.lang.String,​Applications> remoteRegionsRegistry,
                                             EurekaClientConfig clientConfig,
                                             InstanceRegionChecker instanceRegionChecker)
        Shuffles a whole region so that the instances will not always be returned in the same order.
        Parameters:
        remoteRegionsRegistry - the map of remote region names to their registries
        clientConfig - the EurekaClientConfig, whose settings will be used to determine whether to filter to only UP instances
        instanceRegionChecker - the instance region checker
      • 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.
      • removeApplication

        public void removeApplication​(Application app)
        Remove the application from the list.
        Parameters:
        app - the application