public class Janitor extends Object implements Runnable
| Constructor and Description |
|---|
Janitor(int maxjobs) |
| Modifier and Type | Method and Description |
|---|---|
int |
addTask(int interval,
boolean once,
String name,
JanitorTask jt)
Add a new task to the janitor's tables.
|
int |
addTask(int offset,
int interval,
String name,
JanitorTask jt)
Add a new task to the janitor's tables, that first executes after given offset, and repeats in given interval.
|
int |
addTaskAt(Date attime,
String name,
JanitorTask jt)
Adds a task to the janitor's table.
|
boolean |
cancelJob(int id) |
static Janitor |
getJanitor()
Returns the Janitor, the class handling housekeeping chores.
|
long |
getTime()
Returns the current time, in milliseconds, as returned from System.currentTimeMillis()
|
long |
getTimeStamp()
Returns the last scheduler's run timestamp.
|
protected void |
logTask(JanitorThread jt,
String msg) |
boolean |
mustTerminate() |
void |
run()
The main Janitor thread loop.
|
void |
start()
Starts this janitor as a new thread; it waits till the thread starts!
|
public void start()
public long getTime()
protected void logTask(JanitorThread jt, String msg)
public int addTask(int interval,
boolean once,
String name,
JanitorTask jt)
throws Exception
interval - interval in secondsonce - TRUE if this is a single-shot eventname - The name of the dude for info ppsjt - The task functor to call at time zero.Exceptionpublic int addTask(int offset,
int interval,
String name,
JanitorTask jt)
throws Exception
offset - offset interval in seconds, before task runs for first timeinterval - interval in secondsname - The name of the dude for info ppsjt - The task functor to call at time zero.Exceptionpublic int addTaskAt(Date attime, String name, JanitorTask jt) throws Exception
Exceptionpublic boolean cancelJob(int id)
public boolean mustTerminate()
public void run()
public long getTimeStamp()
public static Janitor getJanitor()
Copyright © 2017 etc.to. All rights reserved.