• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Scheduler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中it.sauronsoftware.cron4j.Scheduler的典型用法代码示例。如果您正苦于以下问题:Java Scheduler类的具体用法?Java Scheduler怎么用?Java Scheduler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Scheduler类属于it.sauronsoftware.cron4j包,在下文中一共展示了Scheduler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:21,代码来源:CronPolicy.java


示例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);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:26,代码来源:ScheduleFutureImpl.java


示例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");
}
 
开发者ID:comdata,项目名称:HomeAutomation,代码行数:17,代码来源:SchedulerThread.java


示例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();
}
 
开发者ID:donsez,项目名称:tagl,代码行数:19,代码来源:Main.java


示例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();
}
 
开发者ID:donsez,项目名称:tagl,代码行数:23,代码来源:Main.java


示例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();
}
 
开发者ID:donsez,项目名称:tagl,代码行数:19,代码来源:Main.java


示例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) {
            ;
        }
    }
 
开发者ID:josejamilena,项目名称:pfc-jose,代码行数:26,代码来源:Main.java


示例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();
	}
 
开发者ID:josejamilena,项目名称:pfc-jose,代码行数:20,代码来源:Main.java


示例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) {
            ;
        }
    }
 
开发者ID:josejamilena,项目名称:pfc-jose,代码行数:22,代码来源:Main.java


示例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();
}
 
开发者ID:quanticc,项目名称:ugc-bot-redux,代码行数:12,代码来源:TaskService.java


示例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();
}
 
开发者ID:T-baby,项目名称:ICERest-plugin,代码行数:10,代码来源:Cron4jPlugin.java


示例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();
}
 
开发者ID:iwxfer,项目名称:video2gif,代码行数:15,代码来源:Do.java


示例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();
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:10,代码来源:SchedulingService.java


示例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();
    }

}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:12,代码来源:RMDBManager.java


示例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);
}
 
开发者ID:chory-amam,项目名称:slack-capybara,代码行数:9,代码来源:CronHandlers.java


示例16: contextInitialized

import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
public void contextInitialized(ServletContextEvent event) {
	ServletContext context = event.getServletContext();
	// 1. Creates the scheduler.
	Scheduler scheduler = new Scheduler();
	// 2. Registers a custom task collector.
	TaskCollector collector = new MyTaskCollector();
	scheduler.addTaskCollector(collector);
	// 3. Starts the scheduler.
	scheduler.start();
	// 4. Registers the scheduler.
	context.setAttribute(Constants.SCHEDULER, scheduler);
}
 
开发者ID:donsez,项目名称:tagl,代码行数:13,代码来源:SchedulerServletContextListener.java


示例17: contextDestroyed

import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
public void contextDestroyed(ServletContextEvent event) {
	ServletContext context = event.getServletContext();
	// 1. Retrieves the scheduler from the context.
	Scheduler scheduler = (Scheduler) context.getAttribute(Constants.SCHEDULER);
	// 2. Removes the scheduler from the context.
	context.removeAttribute(Constants.SCHEDULER);
	// 3. Stops the scheduler.
	scheduler.stop();
}
 
开发者ID:donsez,项目名称:tagl,代码行数:10,代码来源:SchedulerServletContextListener.java


示例18: init

import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void init(BackgroundModuleDescriptor descriptor, SectionInterface sectionInterface, DataSource dataSource) throws Exception {

	super.init(descriptor, sectionInterface, dataSource);

	cacheFlows();

	systemInterface.getEventHandler().addEventListener(CRUDEvent.class, this, Flow.class);

	scheduler = new Scheduler();
	scheduler.schedule("0 * * * *", this);
	scheduler.start();
}
 
开发者ID:Sundsvallskommun,项目名称:Open-ePlatform,代码行数:15,代码来源:PopularFlowFamiliesModule.java


示例19: initScheduler

import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
protected synchronized void initScheduler() {

		scheduler = new Scheduler();

		scheduler.schedule("1 0 * * 1", new WeeklyStatisticsReloader());
		scheduler.schedule(this.changeCheckInterval, this);
		scheduler.start();
	}
 
开发者ID:Sundsvallskommun,项目名称:Open-ePlatform,代码行数:9,代码来源:StatisticsModule.java


示例20: testScheduler

import it.sauronsoftware.cron4j.Scheduler; //导入依赖的package包/类
private static void testScheduler() {
    // Creates a Scheduler instance.
    Scheduler scheduler = new Scheduler();

    // Schedule a task.
    // * * * * *
    // 分 时 日 月 星
    // http://www.sauronsoftware.it/projects/cron4j/manual.php#p02
    scheduler.schedule("4 11 * * *", new Runnable() {
        public void run() {
            System.out.println(new Date());
            System.out.println("task is run");
            // XXX 在子线程中停止Scheduler无法结束JVM
            // 只能通过System.exit来退出JVM
            // scheduler.stop();
            // System.exit(0);
        }
    });

    // Starts the scheduler.
    scheduler.start();
    // XXX 在主线程中停止Scheduler会结束JVM
    // scheduler.stop();

    System.out.println(new Date());
    System.out.println("Scheduler is start");
}
 
开发者ID:ufologist,项目名称:HttpToolbox,代码行数:28,代码来源:SchedulerExample.java



注:本文中的it.sauronsoftware.cron4j.Scheduler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IWrenchable类代码示例发布时间:2022-05-21
下一篇:
Java OGLSurfaceData类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap