SchedulingPattern con4j every 2 minutes 30 second or 150 seconds

荒凉一梦 提交于 2019-12-24 17:03:19

问题


I have Scheduler use do run every 2 minutes. but i can't use to 2m30s.Please help me

SchedulingPattern pattern = new SchedulingPattern("*/2 * * * *");

回答1:


You can wait 30 seconds after the SchedulingPattern's start.

Scheduler scheduler = new Scheduler();
scheduler.schedule("*/2 * * * *", new Runnable() {

        @Override
        public void run() {
            Thread.sleep(30*1000);
            foo();
        }
    };);
schedule.start();


来源:https://stackoverflow.com/questions/19855830/schedulingpattern-con4j-every-2-minutes-30-second-or-150-seconds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!