Package com.attivio.service
Class AlwaysRefetchServiceProxy
- java.lang.Object
-
- com.attivio.service.AlwaysRefetchServiceProxy
-
- All Implemented Interfaces:
ServiceProxy
,java.lang.reflect.InvocationHandler
public class AlwaysRefetchServiceProxy extends java.lang.Object implements java.lang.reflect.InvocationHandler, ServiceProxy
A service proxy that re-fetches the service every time it is used. By doing this, it will round-robin across the available services and automatically adjust to service outages. This proxy is used for light-weight services.
-
-
Constructor Summary
Constructors Constructor Description AlwaysRefetchServiceProxy(java.lang.Class<?> clazz, org.apache.curator.x.discovery.ServiceInstance<AieServiceInfo> firstInstance)
IffirstInstance
is set, that instance will be used the first time a service method is called.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<?>
getImplementationClass()
java.lang.Object
invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
-
-
-
Constructor Detail
-
AlwaysRefetchServiceProxy
public AlwaysRefetchServiceProxy(java.lang.Class<?> clazz, org.apache.curator.x.discovery.ServiceInstance<AieServiceInfo> firstInstance)
IffirstInstance
is set, that instance will be used the first time a service method is called. Thereafter, the service will be refetched. This is provided as an optimization if an instance was already grabbed to ensure availability prior to construction of the proxy. In such a case, failure to use that instance can lead to service fetching patterns that defeat the round-robin distribution of services. For example, if two instances are available, without this capability, the first one would always be used.- Parameters:
clazz
-firstInstance
- may benull
-
-
Method Detail
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
- Specified by:
invoke
in interfacejava.lang.reflect.InvocationHandler
- Throws:
java.lang.Throwable
-
getImplementationClass
public java.lang.Class<?> getImplementationClass()
- Specified by:
getImplementationClass
in interfaceServiceProxy
- Returns:
- the Class> that is actually proxied
-
-