Class RandomStrategy<T>

  • All Implemented Interfaces:
    ProviderStrategy<T>

    public class RandomStrategy<T>
    extends java.lang.Object
    implements ProviderStrategy<T>
    This strategy always picks a random instance from the list
    • Constructor Detail

      • RandomStrategy

        public RandomStrategy()
    • Method Detail

      • getInstance

        public ServiceInstance<T> getInstance​(InstanceProvider<T> instanceProvider)
                                       throws java.lang.Exception
        Description copied from interface: ProviderStrategy
        Given a source of instances, return one of them for a single use.
        Specified by:
        getInstance in interface ProviderStrategy<T>
        Parameters:
        instanceProvider - the instance provider
        Returns:
        the instance to use
        Throws:
        java.lang.Exception - any errors