Package org.apache.hadoop.io.retry
Class RetryProxy
java.lang.Object
org.apache.hadoop.io.retry.RetryProxy
A factory for creating retry proxies.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Objectcreate(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 givenFailoverProxyProviderand the a set of retry policies specified by method name.static <T> Objectcreate(Class<T> iface, FailoverProxyProvider<T> proxyProvider, RetryPolicy retryPolicy) Create a proxy for an interface of implementations of that interface using the givenFailoverProxyProviderand the same retry policy for each method in the interface.static <T> Objectcreate(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.static <T> Objectcreate(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.
-
Constructor Details
-
RetryProxy
public RetryProxy()
-
-
Method Details
-
create
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 implementimplementation- the instance whose methods should be retriedretryPolicy- 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 givenFailoverProxyProviderand the same retry policy for each method in the interface.- Type Parameters:
T- T.- Parameters:
iface- the interface that the retry will implementproxyProvider- provides implementation instances whose methods should be retriedretryPolicy- 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 ofRetryPolicies.TRY_ONCE_THEN_FAILis used.- Type Parameters:
T- T.- Parameters:
iface- the interface that the retry will implementimplementation- the instance whose methods should be retriedmethodNameToPolicyMap- 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 givenFailoverProxyProviderand the a set of retry policies specified by method name. If no retry policy is defined for a method then a default ofRetryPolicies.TRY_ONCE_THEN_FAILis used.- Type Parameters:
T- T.- Parameters:
iface- the interface that the retry will implementproxyProvider- provides implementation instances whose methods should be retriedmethodNameToPolicyMap- map of method names to retry policiesdefaultPolicy- defaultPolicy.- Returns:
- the retry proxy
-