*** This class provides Binary Compatibility only, not Source Compatibility ***

Class LookupPolicyAttempts

java.lang.Object
com.sas.services.discovery.LookupPolicyAttempts
All Implemented Interfaces:
LookupPolicyInterface

@SASScope("ALL") @BinaryCompatibilityOnly public class LookupPolicyAttempts extends Object implements LookupPolicyInterface
A service discovery policy that will re-attempt to lookup services for a specified number of attempts.

An instance of this class may be passed to the ServiceLoader to cause a lookup to be repeated for a specified number of times until either it succeeds or until the maximum number of attempts is met. Refer to ServiceLoader.lookupRemoteDiscoveryServices(com.sas.services.deployment.MetadataSourceInterface, DiscoveryServiceInterface, LookupPolicyInterface)

Since:
1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a service lookup timeout policy using a default timeout.
    LookupPolicyAttempts(int maxNumAttempts, long attemptIntervalInMsec)
    Constructs an instance of a service lookup timeout policy using the specified timeout.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    isOKToRetryLookup(String serviceLookupRequestId)
    In the event that a local service lookup fails to return any results, this method will be invoked to determine whether or not the service lookup should be re-attempted.
    final void
    serviceLookupInitiated(String serviceLookupRequestId)
    Notifies the policy implementation that a service lookup has started.
    final void
    serviceLookupTerminated(String serviceLookupRequestId)
    Notifies the policy implementation that a service lookup has been terminated.
    final void
    setMaxNumAttempts(int maxNumAttempts)
    Specifies the maximum number of attempts that should be made when looking up services.
    final void
    setPauseInterval(long attemptIntervalInMsec)
    Specifies the minimum amount of time in msec that should elapse between service discovery attempts.
    final String
    Gets a string representation of the state of this object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LookupPolicyAttempts

      public LookupPolicyAttempts()
      Constructs a service lookup timeout policy using a default timeout.
    • LookupPolicyAttempts

      public LookupPolicyAttempts(int maxNumAttempts, long attemptIntervalInMsec)
      Constructs an instance of a service lookup timeout policy using the specified timeout.
      Parameters:
      maxNumAttempts - The maximum number of attempts that should be performed to find services before giving up.
      attemptIntervalInMsec - The minimum amount of time that should elapse between attempts in msec.
      Throws:
      IllegalArgumentException - if an invalid timeout parameter is specified.
  • Method Details

    • setMaxNumAttempts

      public final void setMaxNumAttempts(int maxNumAttempts)
      Specifies the maximum number of attempts that should be made when looking up services.
      Parameters:
      maxNumAttempts - The maximum number of attempts.
    • setPauseInterval

      public final void setPauseInterval(long attemptIntervalInMsec)
      Specifies the minimum amount of time in msec that should elapse between service discovery attempts.
      Parameters:
      attemptIntervalInMsec - The minimum amount of time that should elapse between attempts in msec.
    • serviceLookupInitiated

      public final void serviceLookupInitiated(String serviceLookupRequestId)
      Notifies the policy implementation that a service lookup has started.
      Specified by:
      serviceLookupInitiated in interface LookupPolicyInterface
      Parameters:
      serviceLookupRequestId - An ID that the policy control implementation can use to distinguish between multiple service lookup requests. This value will be used in future interactions between the local discovery service and this policy implementation. Refer to the following methods for additional details.
    • serviceLookupTerminated

      public final void serviceLookupTerminated(String serviceLookupRequestId)
      Notifies the policy implementation that a service lookup has been terminated.
      Specified by:
      serviceLookupTerminated in interface LookupPolicyInterface
      Parameters:
      serviceLookupRequestId - An ID that the policy control implementation can use to distinguish between multiple service lookup requests. This value was originally provided to the policy implementation when it was notified of the start of a service lookup via the (String) serviceLookupInitiated (serviceLookupRequestId) method.
    • isOKToRetryLookup

      public final boolean isOKToRetryLookup(String serviceLookupRequestId)
      In the event that a local service lookup fails to return any results, this method will be invoked to determine whether or not the service lookup should be re-attempted.
      Specified by:
      isOKToRetryLookup in interface LookupPolicyInterface
      Parameters:
      serviceLookupRequestId - The ID associated with a particular service lookup request. The policy control implementation can use to distinguish between multiple service lookup requests. This value was originally provided to the policy implementation when it was notified of the start of a service lookup via the (String) serviceLookupInitiated (serviceLookupRequestId) method.
      Returns:
      true if the service lookup should be re-attempted or false if it shouldn't.
    • toString

      public final String toString()
      Gets a string representation of the state of this object.
      Overrides:
      toString in class Object
      Returns:
      Descriptive string detailing the currently specified timeout parameters:
      • maximum number of attempts
      • interval between attempts (msec)