public final class RefreshListeners
extends java.lang.Object
implements org.apache.lucene.search.ReferenceManager.RefreshListener
IndexShard
but kept here so it can be tested without standing up the entire thing.Constructor and Description |
---|
RefreshListeners(java.util.function.IntSupplier getMaxRefreshListeners,
java.lang.Runnable forceRefresh,
java.util.concurrent.Executor listenerExecutor,
org.apache.logging.log4j.Logger logger) |
Modifier and Type | Method and Description |
---|---|
boolean |
addOrNotify(Translog.Location location,
java.util.function.Consumer<java.lang.Boolean> listener)
Add a listener for refreshes, calling it immediately if the location is already visible.
|
void |
afterRefresh(boolean didRefresh) |
void |
beforeRefresh() |
boolean |
refreshNeeded()
Returns true if there are pending listeners.
|
void |
setTranslog(Translog translog)
Setup the translog used to find the last refreshed location.
|
public RefreshListeners(java.util.function.IntSupplier getMaxRefreshListeners, java.lang.Runnable forceRefresh, java.util.concurrent.Executor listenerExecutor, org.apache.logging.log4j.Logger logger)
public boolean addOrNotify(Translog.Location location, java.util.function.Consumer<java.lang.Boolean> listener)
location
- the location to listen forlistener
- for the refresh. Called with true if registering the listener ran it out of slots and forced a refresh. Called with
false otherwise.public boolean refreshNeeded()
public void setTranslog(Translog translog)
public void beforeRefresh() throws java.io.IOException
beforeRefresh
in interface org.apache.lucene.search.ReferenceManager.RefreshListener
java.io.IOException
public void afterRefresh(boolean didRefresh) throws java.io.IOException
afterRefresh
in interface org.apache.lucene.search.ReferenceManager.RefreshListener
java.io.IOException