public class RefreshLimiter
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Class and Description |
|---|---|
protected static class |
RefreshLimiter.Index
Maintains information about the state of each Elastic index that we are tracking.
|
| Constructor and Description |
|---|
RefreshLimiter(RefreshLimiterConfig config,
ElasticClient elasticClient) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Called during shutdown to terminate the scheduled executor thread.
|
void |
enqueueRefresh(java.lang.String name)
Refreshes the given index asynchronously.
|
ElasticClient |
getElasticClient()
Returns a reference to our
ElasticClient. |
RefreshStats |
getStats(java.lang.String name) |
java.lang.String |
toString() |
boolean |
tryRefresh(java.lang.String name) |
boolean |
tryRefresh(java.lang.String name,
long timeout,
java.util.concurrent.TimeUnit unit) |
boolean |
waitForRefresh(java.lang.String name,
long timeout,
java.util.concurrent.TimeUnit unit)
Returns true if Elastic refresh is required and occurred within the given time frame; also
returns true if refresh is not required.
|
public RefreshLimiter(RefreshLimiterConfig config, ElasticClient elasticClient)
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic void enqueueRefresh(java.lang.String name)
throws java.util.concurrent.RejectedExecutionException
name - index namejava.util.concurrent.RejectedExecutionException - if exceptions occurs while refreshing indexpublic final ElasticClient getElasticClient()
ElasticClient.ElasticClient.public RefreshStats getStats(java.lang.String name)
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean tryRefresh(java.lang.String name)
public boolean tryRefresh(java.lang.String name,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic boolean waitForRefresh(java.lang.String name,
long timeout,
java.util.concurrent.TimeUnit unit)
name - index nametimeout - Length of time in milliseconds to wait for a refresh to occurunit - timeout units