org.jvnet.hudson.plugins.thinbackup.hudson.model
Class AsyncPeriodicWork
java.lang.Object
java.util.TimerTask
hudson.triggers.SafeTimerTask
hudson.model.PeriodicWork
org.jvnet.hudson.plugins.thinbackup.hudson.model.AsyncPeriodicWork
- All Implemented Interfaces:
- hudson.ExtensionPoint, java.lang.Runnable
- Direct Known Subclasses:
- ThinBackupPeriodicWork
public abstract class AsyncPeriodicWork
- extends hudson.model.PeriodicWork
Duplicated to reduce the log levels in doRun() from INFO to FINEST so the logs are not spammed every minute.
PeriodicWork that takes a long time to run.
Subclasses will implement the execute(TaskListener) method and can carry out a long-running task. This runs
in a separate thread so as not to block the timer thread, and this class handles all those details.
- Author:
- Kohsuke Kawaguchi
| Nested classes/interfaces inherited from interface hudson.ExtensionPoint |
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson |
|
Field Summary |
java.lang.String |
name
Name of the work. |
| Fields inherited from class hudson.model.PeriodicWork |
DAY, HOUR, logger, MIN |
|
Method Summary |
protected hudson.util.StreamTaskListener |
createListener()
|
void |
doRun()
Schedules this periodic work now in a new thread, if one isn't already running. |
protected abstract void |
execute(hudson.model.TaskListener listener)
Executes the task. |
protected java.io.File |
getLogFile()
Determines the log file that records the result of this task. |
| Methods inherited from class hudson.model.PeriodicWork |
all, getInitialDelay, getRecurrencePeriod |
| Methods inherited from class hudson.triggers.SafeTimerTask |
run |
| Methods inherited from class java.util.TimerTask |
cancel, scheduledExecutionTime |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
name
public final java.lang.String name
- Name of the work.
AsyncPeriodicWork
protected AsyncPeriodicWork(java.lang.String name)
doRun
public final void doRun()
- Schedules this periodic work now in a new thread, if one isn't already running.
- Specified by:
doRun in class hudson.triggers.SafeTimerTask
createListener
protected hudson.util.StreamTaskListener createListener()
getLogFile
protected java.io.File getLogFile()
- Determines the log file that records the result of this task.
execute
protected abstract void execute(hudson.model.TaskListener listener)
throws java.io.IOException,
java.lang.InterruptedException
- Executes the task.
- Parameters:
listener - Output sent will be reported to the users. (this work is TBD.)
- Throws:
java.lang.InterruptedException - The caller will record the exception and moves on.
java.io.IOException - The caller will record the exception and moves on.
Copyright © 2004-2011 Borland (a Microfocus Company). All Rights Reserved.