All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nz.ac.auckland.jobs.periodic.DefaultConfiguration.groovy Maven / Gradle / Ivy

The newest version!
package nz.ac.auckland.jobs.periodic

import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import java.lang.annotation.Target

/**
 * Allows to configure delays and 'availability' of the job. In the presence of NamedJob annotation
 *  this configuration can be overridden in the property file.
 *
 * Hardcoding values 5 and 300, not making them configurable because its not very useful
 *
 * author: Irina Benediktovich - http://plus.google.com/+IrinaBenediktovich
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface DefaultConfiguration {

	/**
	 * Disabled jobs will not be scheduled
	 * @return
	 */
	boolean enabled() default true

	/**
	 * Delay before first execution (in seconds)
	 * @return
	 */
	long initialDelay() default 5l

	/**
	 * A simplest way to define a periodic job (without using cron rules). Sets a delay between job executions
	 *   (between end of previous job and start of next job) in seconds.
	 *
	 * Set to negative value if you only want your job to run once (Intellij IDEA may complain, but it compiles anyway)
	 *   Initial delay will still be respected.
	 *
	 * @return delay between job executions (between end of previous job and start of next job) in seconds.
	 */
	long delay() default 300l

	/**
	 * For cron type jobs. If set, delay is ignored
	 */
	String cron() default ""
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy