Package org.alfresco.util
Class ConfigScheduler<Data>
- java.lang.Object
-
- org.alfresco.util.ConfigScheduler<Data>
-
public abstract class ConfigScheduler<Data> extends java.lang.Object
Used to schedule reading of config. The config is assumed to change from time to time. Initially or on error the reading frequency is high but slower once no problems are reported. If the normal cron schedule is not set or is in the past, the config is read only once whenrun(boolean, Log, CronExpression, CronExpression)
is called.- Author:
- adavis
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConfigScheduler.ConfigSchedulerJob
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONFIG_SCHEDULER
protected Data
data
-
Constructor Summary
Constructors Constructor Description ConfigScheduler(java.lang.Object client)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Data
createData()
Data
getData()
abstract boolean
readConfig()
boolean
readConfigAndReplace(boolean scheduledRead)
Should only be called directly from test code.void
run(boolean enabled, org.apache.commons.logging.Log log, org.quartz.CronExpression cronExpression, org.quartz.CronExpression initialAndOnErrorCronExpression)
This method should only be called once in production on startup generally from Spring afterPropertiesSet methods.
-
-
-
Field Detail
-
CONFIG_SCHEDULER
public static final java.lang.String CONFIG_SCHEDULER
- See Also:
- Constant Field Values
-
data
protected Data data
-
-
Method Detail
-
readConfig
public abstract boolean readConfig() throws java.io.IOException
- Throws:
java.io.IOException
-
createData
public abstract Data createData()
-
getData
public Data getData()
-
run
public void run(boolean enabled, org.apache.commons.logging.Log log, org.quartz.CronExpression cronExpression, org.quartz.CronExpression initialAndOnErrorCronExpression)
This method should only be called once in production on startup generally from Spring afterPropertiesSet methods. In testing it is allowed to call this method multiple times, but in that case it is recommended to pass in a null cronExpression (or a cronExpression such as a date in the past) so the scheduler is not started. If this is done, the config is still read, but before the method returns.
-
readConfigAndReplace
public boolean readConfigAndReplace(boolean scheduledRead)
Should only be called directly from test code.
-
-