public final class InternalJobQueue
extends java.util.TimerTask
Job.ExecutionTime
setting. The configuration
is done in the base.config
file with the following settings:
Setting | Default/possible value(s) | Description |
---|---|---|
jobqueue.internal.enabled | true | false | If the internal job queue is enabled or not. Do not disable the job queue if you don't have another external job queue manager. It is possible to use both an external and internal job queue. |
jobqueue.internal.checkinterval | 30 | The interval, in seconds, that the job queue checks the database for new jobs. |
jobqueue.internal.maxthreadpriority | Thread.NORM_PRIORITY - 1 |
The maximum thread priority for the threads that execute jobs.
See Thread.setPriority(int) for possible values.
|
jobqueue.internal.shortest.threads | 1 | Number of threads to reserve for jobs with an estimated execution time of less than one minute. Jobs with this setting may also use threads from the other "slower" slots. |
jobqueue.internal.shortest.threadpriority | Thread.NORM_PRIORITY - 1 |
The thread priority to use when executing jobs in this slot.
See Thread.setPriority(int) for possible values.
|
jobqueue.internal.short.threads | 1 | Number of threads to reserve for jobs with an estimated execution time between one and ten minutes. Jobs with this setting may also use threads from the other "slower" slots. |
jobqueue.internal.short.threadpriority | Thread.NORM_PRIORITY - 1 |
The thread priority to use when executing jobs in this slot.
See Thread.setPriority(int) for possible values.
|
jobqueue.internal.medium.threads | 2 | Number of threads to reserve for jobs with an estimated execution time less than one hour. Jobs with this setting may also use threads from the other "slower" slots. |
jobqueue.internal.medium.threadpriority | Thread.NORM_PRIORITY - 2 |
The thread priority to use when executing jobs in this slot.
See Thread.setPriority(int) for possible values.
|
jobqueue.internal.long.threads | 4 | Number of threads to reserve for jobs with an estimated execution time more than one hour. Jobs with this setting may not use threads from the other slots. |
jobqueue.internal.long.threadpriority | Thread.NORM_PRIORITY - 2 |
The thread priority to use when executing jobs in this slot.
See Thread.setPriority(int) for possible values.
|
Modifier and Type | Class and Description |
---|---|
private static class |
InternalJobQueue.JobQueueKeyring
Our own keyring containing the permissions we need to execute the jobs.
|
private class |
InternalJobQueue.JobRunner
Encapsulates the running of a job in a separate thread.
|
Modifier and Type | Field and Description |
---|---|
private int |
closeTimeout
Timeout to wait for jobs to act on the ABORT signal when shutting down BASE.
|
private boolean |
ignoreUseInternalJobQueueFlag
If the
PluginDefinitionData.getUseInternalJobQueue() setting
should be ignored or not. |
private static org.slf4j.Logger |
log
Log job queue events.
|
private java.util.Map<Job.ExecutionTime,java.lang.Integer> |
maxSlots
The maximum number of threads that are allowed in each slot.
|
private long |
nextStatusUpdateRequest
Time when the next status update request for external jobs
is scheduled.
|
private java.util.Map<Job.ExecutionTime,java.lang.Integer> |
priorities
The thread priority to use when executing jobs in each slot.
|
private java.util.Set<InternalJobQueue.JobRunner> |
runners
Holds all currently executing jobs.
|
private java.lang.ThreadGroup |
runnersGroup
The group were all job runners are placed.
|
private SessionControl |
sc
The job queues session controller.
|
private static SignalReceiver |
signalReceiver
Use the local signal receiver only.
|
private java.util.Map<Job.ExecutionTime,java.lang.Integer> |
usedSlots
The current number of threads executing in each slot.
|
Constructor and Description |
---|
InternalJobQueue()
Create the job queue.
|
Modifier and Type | Method and Description |
---|---|
private void |
checkInternalJobQueue() |
(package private) void |
close()
Cleanup
|
static SignalReceiver |
getSignalReceiver()
Get the signal receiver used by the internal job queue.
|
private void |
jobDone(InternalJobQueue.JobRunner runner)
Called from a
InternalJobQueue.JobRunner when it has finished
executing the job. |
private void |
requestExternalStatusUpdate() |
void |
run()
Check the database for jobs that are waiting to be executed.
|
private void |
sendErrorMessage(SessionControl impersonated,
int jobId,
java.lang.Throwable ex) |
private static final org.slf4j.Logger log
private final SessionControl sc
InternalJobQueue.JobQueueKeyring
.private final java.util.Map<Job.ExecutionTime,java.lang.Integer> usedSlots
private final java.util.Map<Job.ExecutionTime,java.lang.Integer> maxSlots
private final java.util.Map<Job.ExecutionTime,java.lang.Integer> priorities
private final java.lang.ThreadGroup runnersGroup
private final java.util.Set<InternalJobQueue.JobRunner> runners
private boolean ignoreUseInternalJobQueueFlag
PluginDefinitionData.getUseInternalJobQueue()
setting
should be ignored or not.private int closeTimeout
private long nextStatusUpdateRequest
private static SignalReceiver signalReceiver
InternalJobQueue()
public static SignalReceiver getSignalReceiver()
LocalSignalReceiver
is created on the first call to this method.public void run()
InternalJobQueue.JobRunner
object which is started in it's own thread.run
in interface java.lang.Runnable
run
in class java.util.TimerTask
private void checkInternalJobQueue()
private void requestExternalStatusUpdate()
private void jobDone(InternalJobQueue.JobRunner runner)
InternalJobQueue.JobRunner
when it has finished
executing the job. IT MUST NEVER FORGET TO CALL THIS METHOD.private void sendErrorMessage(SessionControl impersonated, int jobId, java.lang.Throwable ex)
void close()