|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.netflix.config.AbstractPollingScheduler
public abstract class AbstractPollingScheduler
This class is responsible for scheduling the periodical polling of a configuration source and applying the polling result to a Configuration.
A subclass should supply the specific scheduling logic in schedule(Runnable)
and stop()
.
Constructor Summary | |
---|---|
AbstractPollingScheduler()
Create an instance where ignoreDeletesFromSource is set to false. |
|
AbstractPollingScheduler(boolean ignoreDeletesFromSource)
|
Method Summary | |
---|---|
void |
addPollListener(PollListener l)
Add the PollLisetner |
protected java.lang.Object |
getNextCheckPoint(java.lang.Object lastCheckpoint)
Get the check point used in next PolledConfigurationSource.poll(boolean, Object) . |
protected java.lang.Runnable |
getPollingRunnable(PolledConfigurationSource source,
org.apache.commons.configuration.Configuration config)
Gets the runnable to be scheduled. |
protected void |
initialLoad(PolledConfigurationSource source,
org.apache.commons.configuration.Configuration config)
Do an initial poll from the source and apply the result to the configuration. |
boolean |
isIgnoreDeletesFromSource()
|
protected void |
populateProperties(PollResult result,
org.apache.commons.configuration.Configuration config)
Apply the polled result to the configuration. |
void |
removePollListener(PollListener l)
|
protected abstract void |
schedule(java.lang.Runnable pollingRunnable)
Schedule the runnable for polling the configuration source |
void |
setIgnoreDeletesFromSource(boolean ignoreDeletesFromSource)
Set if the scheduler should ignore deletes from source when applying property changes |
void |
startPolling(PolledConfigurationSource source,
org.apache.commons.configuration.Configuration config)
Initiate the first poll of the configuration source and schedule the runnable. |
abstract void |
stop()
Stop the scheduler |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractPollingScheduler(boolean ignoreDeletesFromSource)
ignoreDeletesFromSource
- true if deletes happened in the configuration source should be ignored
by the Configuration. Warning: If both PollResult.isIncremental()
and this parameter are false, any property in the configuration that is missing in the
polled result will be deleted once the PollResult is applied.public AbstractPollingScheduler()
ignoreDeletesFromSource
is set to false.
AbstractPollingScheduler(boolean)
Method Detail |
---|
protected void initialLoad(PolledConfigurationSource source, org.apache.commons.configuration.Configuration config)
source
- source of the configurationconfig
- Configuration to apply the polling result
java.lang.RuntimeException
- if any error occurs in polling the configuration sourceprotected void populateProperties(PollResult result, org.apache.commons.configuration.Configuration config)
result
- Polled result from sourceprotected java.lang.Runnable getPollingRunnable(PolledConfigurationSource source, org.apache.commons.configuration.Configuration config)
schedule(Runnable)
public void startPolling(PolledConfigurationSource source, org.apache.commons.configuration.Configuration config)
schedule(Runnable)
.
source
- Configuration source being polledconfig
- Configuration where the properties will be updated
java.lang.RuntimeException
- if any error occurs in the initial pollingpublic void addPollListener(PollListener l)
l
- public void removePollListener(PollListener l)
protected java.lang.Object getNextCheckPoint(java.lang.Object lastCheckpoint)
PolledConfigurationSource.poll(boolean, Object)
.
The check point can be used by the PolledConfigurationSource
to determine
the set of records to return. For example, a check point can be a time stamp and
the PolledConfigurationSource
can return the records modified since the time stamp.
This method is called before the poll. The
default implementation returns the check point received from last poll.
lastCheckpoint
- checkPoint from last PollResult.getCheckPoint()
protected abstract void schedule(java.lang.Runnable pollingRunnable)
pollingRunnable
- The runnable to be scheduled.public abstract void stop()
public final boolean isIgnoreDeletesFromSource()
public final void setIgnoreDeletesFromSource(boolean ignoreDeletesFromSource)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |