cronus

lightweight cron library for java

License

License

GroupId

GroupId

com.addthis
ArtifactId

ArtifactId

cronus
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

cronus
lightweight cron library for java
Project Organization

Project Organization

AddThis
Source Code Management

Source Code Management

https://github.com/addthis/cronus

Download cronus

How to add to project

<!-- https://jarcasting.com/artifacts/com.addthis/cronus/ -->
<dependency>
    <groupId>com.addthis</groupId>
    <artifactId>cronus</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.addthis/cronus/
implementation 'com.addthis:cronus:0.1.0'
// https://jarcasting.com/artifacts/com.addthis/cronus/
implementation ("com.addthis:cronus:0.1.0")
'com.addthis:cronus:jar:0.1.0'
<dependency org="com.addthis" name="cronus" rev="0.1.0">
  <artifact name="cronus" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.addthis', module='cronus', version='0.1.0')
)
libraryDependencies += "com.addthis" % "cronus" % "0.1.0"
[com.addthis/cronus "0.1.0"]

Dependencies

compile (3)

Group / Artifact Type Version
com.google.guava : guava jar 17.0
com.google.code.findbugs : jsr305 jar 2.0.3
org.slf4j : slf4j-api jar 1.7.7

test (2)

Group / Artifact Type Version
org.slf4j : slf4j-simple jar 1.7.7
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

cronus

What's this?

cronus is a lightweight cron Java library. It accepts Vixie Cron syntax for specifying patterns. cronus uses JSR 311 and requires Java 8 or higher.

Building

cronus uses Apache Maven which it is beyond the scope to detail. The super simple quick start is:

mvn test

Use

<dependency>
  <groupId>com.addthis</groupId>
  <artifactId>cronus</artifactId>
  <version>latest-and-greatest</version>
</dependency>

You can either install locally, or releases will eventually make their way to maven central.

Example

        // Create a scheduler with one execution thread
        CronScheduler scheduler = new CronScheduler.Builder(1).build();
        // Create a pattern that runs every minute
        Future<?> future = scheduler.schedule(CronPattern.build("* * * * *"),
            () -> System.out.println("hello world"), false);
        // Scheduled patterns do not execute until scheduler is started up
        scheduler.start();
        for(int i = 0; i < 70; i++) {
            Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
            System.out.print(i + " ");
        }
        // Future can be cancelled
        future.cancel(false);
        for(int i = 0; i < 50; i++) {
            Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
            System.out.print(i + " ");
        }
        scheduler.stop();

Versioning

It's x.y.z where:

  • x: something major happened
  • y: next release
  • z: bug fix only

License

cronus is released under the Apache License Version 2.0. See Apache or the LICENSE for details.

com.addthis

AddThis

Versions

Version
0.1.0