Package com.attivio.service
Class PooledClientProxy<T>
- java.lang.Object
-
- com.attivio.service.PooledClientProxy<T>
-
- All Implemented Interfaces:
ServiceProxy,java.io.Closeable,java.lang.AutoCloseable,java.lang.reflect.InvocationHandler
public class PooledClientProxy<T> extends java.lang.Object implements java.lang.reflect.InvocationHandler, java.io.Closeable, ServiceProxy
A client proxy that uses a pool of clients to satisfy API requests. Clients in the pool are created on demand and cleaned up if idle for more thanDEFAULT_MAX_IDLE_TIME. If the class provided in the constructor implementsCloseablethen the client will beclosed()before removal from the pool.
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_IDLE_CHECK_INTERVALstatic java.lang.StringDEFAULT_IDLE_CHECK_INTERVAL_PROPstatic longDEFAULT_MAX_IDLE_TIMEstatic java.lang.StringDEFAULT_MAX_IDLE_TIME_PROP
-
Constructor Summary
Constructors Constructor Description PooledClientProxy(ClientApiFactory<T> clientFactory, java.lang.Class<T> apiClass, java.util.List<java.lang.Class<? extends java.util.function.Predicate<java.lang.Throwable>>> transientPredicates)PooledClientProxy(java.lang.Class<T> actualClass, java.util.List<java.lang.Class<? extends java.util.function.Predicate<java.lang.Throwable>>> transientPredicates)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.lang.Class<?>getImplementationClass()java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
-
-
-
Field Detail
-
DEFAULT_MAX_IDLE_TIME_PROP
public static final java.lang.String DEFAULT_MAX_IDLE_TIME_PROP
- See Also:
- Constant Field Values
-
DEFAULT_MAX_IDLE_TIME
public static final long DEFAULT_MAX_IDLE_TIME
- See Also:
- Constant Field Values
-
DEFAULT_IDLE_CHECK_INTERVAL_PROP
public static final java.lang.String DEFAULT_IDLE_CHECK_INTERVAL_PROP
- See Also:
- Constant Field Values
-
DEFAULT_IDLE_CHECK_INTERVAL
public static final long DEFAULT_IDLE_CHECK_INTERVAL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PooledClientProxy
public PooledClientProxy(ClientApiFactory<T> clientFactory, java.lang.Class<T> apiClass, java.util.List<java.lang.Class<? extends java.util.function.Predicate<java.lang.Throwable>>> transientPredicates)
-
PooledClientProxy
public PooledClientProxy(java.lang.Class<T> actualClass, java.util.List<java.lang.Class<? extends java.util.function.Predicate<java.lang.Throwable>>> transientPredicates)
-
-
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:
invokein interfacejava.lang.reflect.InvocationHandler- Throws:
java.lang.Throwable
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
getImplementationClass
public java.lang.Class<?> getImplementationClass()
- Specified by:
getImplementationClassin interfaceServiceProxy- Returns:
- the Class> that is actually proxied
-
-