オープンソースコラム


2009/05/13 19:10Update

cron4j - UNIX cronデーモン機能を実装したJavaジョブ・スケジューラ

TAGS: cron | Java | ジョブ | スケジューラ | LGPL

スポンサード リンク


cron4jは、UNIX cronデーモン機能を実装したJavaジョブ・スケジューラです。簡単な使い方は特徴的です。                                              

言語:Java
ライセンス:LGPL

簡単な例
import it.sauronsoftware.cron4j.Scheduler;
public class Quickstart {

    public static void main(String[] args) {
        // Creates a Scheduler instance.
        Scheduler s = new Scheduler();
        // Schedule a once-a-minute task.
        s.schedule("* * * * *", new Runnable() {
            public void run() {
                System.out.println("Another minute ticked away...");
            }
        });
        // Starts the scheduler.
        s.start();
        // Will run for ten minutes.
        try {
            Thread.sleep(1000L * 60L * 10L);
        } catch (InterruptedException e) {
            ;
        }
        // Stops the scheduler.
        s.stop();
    }

}


使い方詳細は
cron4j - Documentation and manual

Sponsored Link