本文整理汇总了Java中it.sauronsoftware.cron4j.Scheduler类的典型用法代码示例。如果您正苦于以下问题:Java Scheduler类的具体用法?Java Scheduler怎么用?Java Scheduler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Scheduler类属于it.sauronsoftware.cron4j包,在下文中一共展示了Scheduler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
/**
* Configure a policy with given parameters.
* @param policyParameters parameters defined by user
*/
@Override
public BooleanWrapper configure(Object... policyParameters) {
super.configure(policyParameters);
try {
cronScheduler = new Scheduler();
int index = 2;
nodeAcquision = policyParameters[index++].toString();
nodeRemoval = policyParameters[index++].toString();
preemptive = Boolean.parseBoolean(policyParameters[index++].toString());
forceDeployment = Boolean.parseBoolean(policyParameters[index++].toString());
} catch (Throwable t) {
throw new IllegalArgumentException(t);
}
return new BooleanWrapper(true);
}
示例2: ScheduleFutureImpl
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
/**
* Creates descriptor for task scheduling. To start scheduling call {@link #schedule(Callable)}.
*
* @param sched Cron scheduler.
* @param ctx Kernal context.
* @param pat Cron pattern.
*/
ScheduleFutureImpl(Scheduler sched, GridKernalContext ctx, String pat) {
assert sched != null;
assert ctx != null;
assert pat != null;
this.sched = sched;
this.ctx = ctx;
this.pat = pat.trim();
log = ctx.log(getClass());
try {
parsePatternParameters();
}
catch (IgniteCheckedException e) {
onEnd(resLatch, null, e, true);
}
}
示例3: reloadScheduler
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
public void reloadScheduler() {
Scheduler scheduler = getScheduler();
if (scheduler != null && scheduleFile != null) {
scheduler.descheduleFile(scheduleFile);
}
scheduleFile = new File("/var/lib/tomcat8/webapps/HomeAutomation/schedule.cron");
scheduler.scheduleFile(scheduleFile);
if (!scheduler.isStarted()) {
scheduler.start();
}
LogManager.getLogger(this.getClass()).info("Reloaded scheduler");
}
示例4: main
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
public static void main(String[] args) {
// Prepares the task.
MyTask task = new MyTask();
// Creates the scheduler.
Scheduler scheduler = new Scheduler();
// Schedules the task, once every minute.
scheduler.schedule("* * * * *", task);
// Starts the scheduler.
scheduler.start();
// Stays alive for five minutes.
try {
Thread.sleep(5L * 60L * 1000L);
} catch (InterruptedException e) {
;
}
// Stops the scheduler.
scheduler.stop();
}
示例5: main
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
public static void main(String[] args) {
// Prepares the listener.
MySchedulerListener listener = new MySchedulerListener();
// Prepares the task.
MyTask task = new MyTask();
// Creates the scheduler.
Scheduler scheduler = new Scheduler();
// Registers the listener.
scheduler.addSchedulerListener(listener);
// Schedules the task, once every minute.
scheduler.schedule("* * * * *", task);
// Starts the scheduler.
scheduler.start();
// Stays alive for five minutes.
try {
Thread.sleep(5L * 60L * 1000L);
} catch (InterruptedException e) {
;
}
// Stops the scheduler.
scheduler.stop();
}
示例6: main
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
public static void main(String[] args) {
// Declares the file.
File file = new File("cron4jtab.txt");
// Creates the scheduler.
Scheduler scheduler = new Scheduler();
// Schedules the file.
scheduler.scheduleFile(file);
// Starts the scheduler.
scheduler.start();
// Stays alive for five minutes.
try {
Thread.sleep(5L * 60L * 1000L);
} catch (InterruptedException e) {
;
}
// Stops the scheduler.
scheduler.stop();
}
示例7: main
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
public static void main(String[] args) {
Comun.iniciarPropiedades();
String usuario = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("USUARIO_ORACLE");
String dirOracle = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("SERVIDOR_ORACLE");
String puertoOracle = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("PUERTO_ORACLE");
String baseDeDatos = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("BD_ORACLE");
usuario = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("USUARIO_ESTADISTICAS");
dirOracle = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("SERVIDOR_ESTADISTICAS");
puertoOracle = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("PUERTO_ESTADISTICAS");
baseDeDatos = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("BD_ESTADISTICAS");
msg = new VisorMsg();
msg.setVisible(true);
msg.setTitle("Tiempos de respuesta de Oracle");
MyTask task = new MyTask();
Scheduler scheduler = new Scheduler();
scheduler.schedule(Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("PLANIFICACION"), task);
scheduler.start();
while (true) {
;
}
}
示例8: main
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
public static void main(String[] args) {
// Prepares the task.
MyTask task = new MyTask();
// Creates the scheduler.
Scheduler scheduler = new Scheduler();
// Schedules the task, once every minute.
scheduler.schedule("44 12 * * 0,1,2,3,4,5,6", task);
// Starts the scheduler.
scheduler.start();
// Stays alive for five minutes.
// try {
// Thread.sleep(5L * 60L * 1000L);
while (true) { ; }
// } catch (InterruptedException e) {
// ;
// }
// Stops the scheduler.
// scheduler.stop();
}
示例9: main
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
public static void main(String[] args) {
Comun.iniciarPropiedades();
String usuario = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("USUARIO_ORACLE");
String dirOracle = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("SERVIDOR_ORACLE");
String puertoOracle = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("PUERTO_ORACLE");
String baseDeDatos = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("BD_ORACLE");
usuario = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("USUARIO_ESTADISTICAS");
dirOracle = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("SERVIDOR_ESTADISTICAS");
puertoOracle = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("PUERTO_ESTADISTICAS");
baseDeDatos = Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("BD_ESTADISTICAS");
MyTask task = new MyTask();
Scheduler scheduler = new Scheduler();
scheduler.schedule(Comun.PROPIEDADES_DE_CONFIGURACION.getProperty("PLANIFICACION"), task);
scheduler.start();
while (true) {
;
}
}
示例10: TaskService
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
@Autowired
public TaskService(ScheduledTaskRepository repository, UpdatesFeedService updatesFeedService,
GameServerService gameServerService, ExpireStatusService expireStatusService,
Executor taskExecutor) {
this.repository = repository;
this.updatesFeedService = updatesFeedService;
this.gameServerService = gameServerService;
this.expireStatusService = expireStatusService;
this.taskExecutor = taskExecutor;
this.scheduler = new Scheduler();
}
示例11: startJobs
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
private void startJobs() {
scheduler = new Scheduler();
Set<Entry<Runnable, String>> set = jobs.entrySet();
for (Entry<Runnable, String> entry : set) {
scheduler.schedule(entry.getValue(), entry.getKey());
log.debug(entry.getValue() + " has been scheduled to run and repeat based on expression: " + entry.getKey());
}
scheduler.start();
}
示例12: main
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
public static void main(String[] args) throws Throwable {
Scheduler s = new Scheduler();
s.schedule("* * * * *", new GifGenerator());
s.start();
try {
Thread.sleep(1L * 6000L * 60L * 10L); // 1 hour
} catch (InterruptedException e) {
;
}
s.stop();
}
示例13: startHouseKeeping
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
public void startHouseKeeping() {
houseKeepingScheduler = new Scheduler();
String cronExpr = "* * * * *";
if (PASchedulerProperties.SCHEDULER_AUTOMATIC_REMOVED_JOB_CRON_EXPR.isSet()) {
cronExpr = PASchedulerProperties.SCHEDULER_AUTOMATIC_REMOVED_JOB_CRON_EXPR.getValueAsString();
}
houseKeepingScheduler.schedule(cronExpr, new HousekeepingRunner());
houseKeepingScheduler.start();
}
示例14: startHouseKeeping
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
public void startHouseKeeping() {
houseKeepingScheduler = new Scheduler();
if (PAResourceManagerProperties.RM_HISTORY_MAX_PERIOD.isSet() &&
PAResourceManagerProperties.RM_HISTORY_MAX_PERIOD.getValueAsLong() > 0 &&
PAResourceManagerProperties.RM_HISTORY_REMOVAL_CRONPERIOD.isSet()) {
String cronExpr = PAResourceManagerProperties.RM_HISTORY_REMOVAL_CRONPERIOD.getValueAsString();
houseKeepingScheduler.schedule(cronExpr, new HousekeepingRunner());
houseKeepingScheduler.start();
}
}
示例15: initialize
import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
@Override
public final void initialize(final Robot robot) {
scheduler = new Scheduler();
// start cron4j scheduler.
scheduler.start();
remember(robot);
}