Class AsyncResolver<T extends EurekaEndpoint>
- java.lang.Object
-
- com.netflix.discovery.shared.resolver.AsyncResolver<T>
-
- All Implemented Interfaces:
ClosableResolver<T>,ClusterResolver<T>
public class AsyncResolver<T extends EurekaEndpoint> extends java.lang.Object implements ClosableResolver<T>
An async resolver that keeps a cached version of the endpoint list value for gets, and updates this cache periodically in a different thread.
-
-
Constructor Summary
Constructors Constructor Description AsyncResolver(java.lang.String name, ClusterResolver<T> delegate, int executorThreadPoolSize, int refreshIntervalMs, int warmUpTimeoutMs)Create an async resolver with an empty initial value.AsyncResolver(java.lang.String name, ClusterResolver<T> delegate, java.util.List<T> initialValues, int executorThreadPoolSize, int refreshIntervalMs)Create an async resolver with a preset initial value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<T>getClusterEndpoints()longgetEndpointsSize()longgetLastLoadTimestamp()java.lang.StringgetRegion()voidshutdown()
-
-
-
Constructor Detail
-
AsyncResolver
public AsyncResolver(java.lang.String name, ClusterResolver<T> delegate, int executorThreadPoolSize, int refreshIntervalMs, int warmUpTimeoutMs)Create an async resolver with an empty initial value. When this resolver is called for the first time, an initial warm up will be executed before scheduling the periodic update task.
-
AsyncResolver
public AsyncResolver(java.lang.String name, ClusterResolver<T> delegate, java.util.List<T> initialValues, int executorThreadPoolSize, int refreshIntervalMs)Create an async resolver with a preset initial value. WHen this resolver is called for the first time, there will be no warm up and the initial value will be returned. The periodic update task will not be scheduled until after the first time getClusterEndpoints call.
-
-
Method Detail
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceClosableResolver<T extends EurekaEndpoint>
-
getRegion
public java.lang.String getRegion()
- Specified by:
getRegionin interfaceClusterResolver<T extends EurekaEndpoint>
-
getClusterEndpoints
public java.util.List<T> getClusterEndpoints()
- Specified by:
getClusterEndpointsin interfaceClusterResolver<T extends EurekaEndpoint>
-
getLastLoadTimestamp
public long getLastLoadTimestamp()
-
getEndpointsSize
public long getEndpointsSize()
-
-