Class 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 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:
        toString in class java.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 status InstanceInfo.InstanceStatus.UP needs to be stored.