public abstract class TimedThreadRequest extends Object implements ThreadRequest, Comparable<TimedThreadRequest>
Run a thread request at a particular time, with options to repeat.
Modifier and Type | Field and Description |
---|---|
static long |
TimedRequestPaused |
Constructor and Description |
---|
TimedThreadRequest(String desc,
long runAt)
Class constructor
|
TimedThreadRequest(String desc,
long runAt,
long repeatSecs)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(TimedThreadRequest timedReq)
Compare timed thread requests for ordering
|
String |
getDescription()
Return the timed reqeust description/name string
|
long |
getRepeatInterval()
Return the repeat interval for the timed request, or zero if this is not a repeating
request.
|
long |
getRunAtTime()
Return the time the request should run at
|
ThreadRequestPool |
getThreadRequestPool()
Return the associated thread pool
|
boolean |
hasRepeatInterval()
Check if the timed request has a repeat interval
|
boolean |
hasThreadRequestPool()
Check if the request is associated with a thread pool, ie.
|
boolean |
isPaused()
Check if hte timed thread request has been paused
|
void |
restartRequest()
Restart a timed request that has been paused
|
void |
runRequest()
Run the request in a thread from the thread pool
|
protected abstract void |
runTimedRequest()
Timed request processing
|
void |
setRepeatInterval(long repeatSecs)
Set the repeat interval, in seconds
|
void |
setRunAtTime(long runAt)
Set the time to run the interval.
|
protected void |
setThreadRequestPool(ThreadRequestPool threadPool)
Thread request pool that the request is queued to
|
String |
toString()
Return the timed thread request as a string
|
public static final long TimedRequestPaused
public TimedThreadRequest(String desc, long runAt)
desc
- StringrunAt
- longpublic TimedThreadRequest(String desc, long runAt, long repeatSecs)
desc
- StringrunAt
- longrepeatSecs
- longpublic final String getDescription()
public final long getRunAtTime()
public final boolean isPaused()
public final boolean hasRepeatInterval()
public final long getRepeatInterval()
public final boolean hasThreadRequestPool()
public final ThreadRequestPool getThreadRequestPool()
public final void setRunAtTime(long runAt)
runAt
- longpublic final void setRepeatInterval(long repeatSecs)
repeatSecs
- longprotected final void setThreadRequestPool(ThreadRequestPool threadPool)
threadPool
- ThreadRequestPoolpublic final void restartRequest()
public void runRequest()
runRequest
in interface ThreadRequest
protected abstract void runTimedRequest()
public int compareTo(TimedThreadRequest timedReq)
compareTo
in interface Comparable<TimedThreadRequest>
timedReq
- TimedThreadRequestCopyright © 2005–2018 Alfresco Software. All rights reserved.