public class CronJob
extends java.lang.Thread
Job associated with one method of object. Job is launched by the CronTable or by one asynchronous Action
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
JOB_STATUS_EXCEPTION
Job has terminated throwing exception
|
static java.lang.String |
JOB_STATUS_INITIAL
Initialized status
|
static java.lang.String |
JOB_STATUS_INTERRUPT
Interrupt is requested
|
static java.lang.String |
JOB_STATUS_PAUSE
Pause is requested
|
static java.lang.String |
JOB_STATUS_RESUME
Resume is requested
|
static java.lang.String |
JOB_STATUS_RUNNING
Job is running
|
static java.lang.String |
JOB_STATUS_SLEEP
Job is sleeping
|
static java.lang.String |
JOB_STATUS_STOPPED
Stopped thru interruption exception
|
static java.lang.String |
JOB_STATUS_TERMINATED
Job has terminated
|
Action |
m_action |
Grant |
m_grant |
ObjectDB |
m_object |
Constructor and Description |
---|
CronJob(ObjectDB object,
Action action,
Grant grant)
Job constructor
|
CronJob(java.lang.String name,
java.lang.String object,
java.lang.String action,
java.lang.String runAs)
Asynchronous constructor on a new job instance of Object and Grant
|
Modifier and Type | Method and Description |
---|---|
static void |
checkForInterruptAndStop(ObjectDB obj)
To call periodically in the asynchronous method to throw one InterruptedException
when one user has requested it to stop.
|
static void |
clearCache() |
java.lang.String |
getJobId()
Standard row_id of the Job
|
java.lang.String |
getJobUid()
Unique key in DB as a String: [thread id]-[timestamp in ms]-[job hash]
|
static java.lang.String |
getStatus(ObjectDB obj)
Get the status of the current CronJob thread
|
void |
run()
Launch the Job
|
static void |
setStatus(ObjectDB obj,
java.lang.String status)
Set the status of the current CronJob thread
|
static java.lang.String |
updateStatus(Grant g,
java.lang.String jobRowId,
java.lang.String status)
Update the AsyncJob status and the start/end dates
|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public static final java.lang.String JOB_STATUS_INITIAL
public static final java.lang.String JOB_STATUS_RUNNING
public static final java.lang.String JOB_STATUS_TERMINATED
public static final java.lang.String JOB_STATUS_EXCEPTION
public static final java.lang.String JOB_STATUS_INTERRUPT
public static final java.lang.String JOB_STATUS_STOPPED
public static final java.lang.String JOB_STATUS_PAUSE
public static final java.lang.String JOB_STATUS_RESUME
public static final java.lang.String JOB_STATUS_SLEEP
public ObjectDB m_object
public Action m_action
public Grant m_grant
public CronJob(java.lang.String name, java.lang.String object, java.lang.String action, java.lang.String runAs)
Asynchronous constructor on a new job instance of Object and Grant
name
- Job name from cron tableobject
- Object nameaction
- Action to call in a new threadrunAs
- Run the thread with this login (default 'system')public static void clearCache()
public java.lang.String getJobId()
public java.lang.String getJobUid()
public static java.lang.String updateStatus(Grant g, java.lang.String jobRowId, java.lang.String status)
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public static void checkForInterruptAndStop(ObjectDB obj) throws java.lang.InterruptedException
To call periodically in the asynchronous method to throw one InterruptedException
when one user has requested it to stop. If this method is never called,
the thread won't be stopped before its end of execution
even if one interruption has been requested by a user.
If the caller needs to end properly (without exception),
use only the checkForInterruptRequest method.
java.lang.InterruptedException
public static java.lang.String getStatus(ObjectDB obj)
public static void setStatus(ObjectDB obj, java.lang.String status)
Copyright (c)2006-2014 Simplicite Software. All Rights Reserved.