From e992cf11f506bcd7d79065827140992e006ebe7c Mon Sep 17 00:00:00 2001 From: kohsuke Date: Thu, 9 Nov 2006 02:26:26 +0000 Subject: [PATCH] doc improvement. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1065 71c3de6d-444a-0410-be80-ed276b4c234a --- .../main/java/hudson/triggers/Trigger.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/hudson/triggers/Trigger.java b/core/src/main/java/hudson/triggers/Trigger.java index 531d06a8c2..c243d3e7e2 100644 --- a/core/src/main/java/hudson/triggers/Trigger.java +++ b/core/src/main/java/hudson/triggers/Trigger.java @@ -1,6 +1,7 @@ package hudson.triggers; import antlr.ANTLRException; +import hudson.ExtensionPoint; import hudson.model.Action; import hudson.model.Build; import hudson.model.Describable; @@ -9,8 +10,6 @@ import hudson.model.Hudson; import hudson.model.Project; import hudson.model.WorkspaceCleanupThread; import hudson.scheduler.CronTabList; -import hudson.ExtensionPoint; -import hudson.tasks.BuildStep; import java.io.InvalidObjectException; import java.io.ObjectStreamException; @@ -46,9 +45,10 @@ public abstract class Trigger implements Describable, ExtensionPoint { /** * Executes the triggered task. * - * This method is invoked when the crontab matches the current time. + * This method is invoked when {@link #Trigger(String)} is used + * to create an instance, and the crontab matches the current time. */ - protected abstract void run(); + protected void run() {} /** * Called before a {@link Trigger} is removed. @@ -71,17 +71,30 @@ public abstract class Trigger implements Describable, ExtensionPoint { protected transient CronTabList tabs; protected transient Project project; + /** + * Creates a new {@link Trigger} that gets {@link #run() run} + * periodically. This is useful when your trigger does + * some polling work. + */ protected Trigger(String cronTabSpec) throws ANTLRException { this.spec = cronTabSpec; this.tabs = CronTabList.create(cronTabSpec); } + /** + * Creates a new {@link Trigger} without using cron. + */ protected Trigger() { this.spec = ""; this.tabs = new CronTabList(Collections.EMPTY_LIST); } - public String getSpec() { + /** + * Gets the crontab specification. + * + * If you are not using cron service, just ignore it. + */ + public final String getSpec() { return spec; } -- GitLab