public class KScheduler2
extends java.lang.Object
KSchedulerClient
. The scheduler must be explicitly started.Constructor and Description |
---|
KScheduler2()
Constructs a new KScheduler object.
|
KScheduler2(java.lang.String name)
Constructs a new KScheduler object using the specified string as the name
of the thread of the scheduler.
|
Modifier and Type | Method and Description |
---|---|
void |
addJob(KSchedulerClient client,
int jobId,
long delay,
boolean recurrent)
Adds a new job in the scheduler.
|
void |
removeAllJobs()
Removes all jobs in the scheduler.
|
void |
removeJob(KSchedulerClient client,
int jobId)
Removes a job for the specified client with the specified job id.
|
void |
start()
Starts the scheduler thread if not already started.
|
void |
stop()
Stops the scheduler thread if started.
|
public KScheduler2()
public KScheduler2(java.lang.String name)
name
- name to use as athe threda namepublic void start()
public void stop()
public void addJob(KSchedulerClient client, int jobId, long delay, boolean recurrent)
client
- the client to notifyjobId
- a number assigned to the job. Must be unique for a given client.delay
- number of milliseconds to wait until the client is notified by the schedulerrecurrent
- if true, the client will be notified recurrently, once every delay millisecondes.
Otherwise, the client will be notified only once.public void removeJob(KSchedulerClient client, int jobId)
client
- the client associated with the jobjobId
- the id of the job to removepublic void removeAllJobs()