public class LookupDataAdapterRefreshService
extends com.google.common.util.concurrent.AbstractIdleService
LookupDataAdapter
refreshes.
Every LookupDataAdapter
can be configured to run a refresh job to load new data, do internal cleanup or
similar tasks. This object takes care of scheduling the refresh so the data adapter don't have to do that on
their own.
A service LookupDataAdapterRefreshService.Listener
instance will be attached to every LookupDataAdapter
during startup. The listener
takes care of adding and removing the LookupDataAdapter
from the refresh service when the data adapter
gets started or stopped.
Modifier and Type | Class and Description |
---|---|
static class |
LookupDataAdapterRefreshService.Listener
This service listener should be attached to a
data adapter service . |
Constructor and Description |
---|
LookupDataAdapterRefreshService(ScheduledExecutorService scheduler,
ConcurrentMap<String,LookupTable> liveTables) |
Modifier and Type | Method and Description |
---|---|
void |
add(LookupDataAdapter dataAdapter)
Add the given
LookupDataAdapter to the refresh service. |
LookupDataAdapterRefreshService.Listener |
newServiceListener(LookupDataAdapter adapter)
Returns a new
Service.Listener to add and remove the given data adapter to the refresh service. |
void |
remove(LookupDataAdapter dataAdapter)
Remove the given
LookupDataAdapter from the refresh service. |
protected void |
shutDown() |
protected void |
startUp() |
public LookupDataAdapterRefreshService(ScheduledExecutorService scheduler, ConcurrentMap<String,LookupTable> liveTables)
protected void startUp() throws Exception
startUp
in class com.google.common.util.concurrent.AbstractIdleService
Exception
protected void shutDown() throws Exception
shutDown
in class com.google.common.util.concurrent.AbstractIdleService
Exception
public LookupDataAdapterRefreshService.Listener newServiceListener(LookupDataAdapter adapter)
Service.Listener
to add and remove the given data adapter to the refresh service.adapter
- the data adapter to be added/removedpublic void add(LookupDataAdapter dataAdapter)
LookupDataAdapter
to the refresh service.
The refresh method
method will be called periodically
according to the refresh interval
of the data adapter.
dataAdapter
- the adapter to be addedpublic void remove(LookupDataAdapter dataAdapter)
LookupDataAdapter
from the refresh service.dataAdapter
- Copyright © 2012–2018 Graylog, Inc.. All rights reserved.