Class RetryProxy

java.lang.Object
org.apache.hadoop.io.retry.RetryProxy

public class RetryProxy extends Object

A factory for creating retry proxies.

  • Constructor Details

    • RetryProxy

      public RetryProxy()
  • Method Details

    • create

      public static <T> Object create(Class<T> iface, T implementation, RetryPolicy retryPolicy)

      Create a proxy for an interface of an implementation class using the same retry policy for each method in the interface.

      Type Parameters:
      T - T.
      Parameters:
      iface - the interface that the retry will implement
      implementation - the instance whose methods should be retried
      retryPolicy - the policy for retrying method call failures
      Returns:
      the retry proxy
    • create

      public static <T> Object create(Class<T> iface, FailoverProxyProvider<T> proxyProvider, RetryPolicy retryPolicy)
      Create a proxy for an interface of implementations of that interface using the given FailoverProxyProvider and the same retry policy for each method in the interface.
      Type Parameters:
      T - T.
      Parameters:
      iface - the interface that the retry will implement
      proxyProvider - provides implementation instances whose methods should be retried
      retryPolicy - the policy for retrying or failing over method call failures
      Returns:
      the retry proxy
    • create

      public static <T> Object create(Class<T> iface, T implementation, Map<String,RetryPolicy> methodNameToPolicyMap)
      Create a proxy for an interface of an implementation class using the a set of retry policies specified by method name. If no retry policy is defined for a method then a default of RetryPolicies.TRY_ONCE_THEN_FAIL is used.
      Type Parameters:
      T - T.
      Parameters:
      iface - the interface that the retry will implement
      implementation - the instance whose methods should be retried
      methodNameToPolicyMap - a map of method names to retry policies
      Returns:
      the retry proxy
    • create

      public static <T> Object create(Class<T> iface, FailoverProxyProvider<T> proxyProvider, Map<String,RetryPolicy> methodNameToPolicyMap, RetryPolicy defaultPolicy)
      Create a proxy for an interface of implementations of that interface using the given FailoverProxyProvider and the a set of retry policies specified by method name. If no retry policy is defined for a method then a default of RetryPolicies.TRY_ONCE_THEN_FAIL is used.
      Type Parameters:
      T - T.
      Parameters:
      iface - the interface that the retry will implement
      proxyProvider - provides implementation instances whose methods should be retried
      methodNameToPolicyMap - map of method names to retry policies
      defaultPolicy - defaultPolicy.
      Returns:
      the retry proxy