Class ScanOnDemandQueue
- java.lang.Object
-
- com.sonyericsson.jenkins.plugins.bfa.sod.ScanOnDemandQueue
-
public final class ScanOnDemandQueue extends Object
A thread-pool and queue implementation for queueing builds for scanning.- Author:
- Shemeer Sulaiman <shemeer.x.sulaiman@sonymobile.com>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ScanOnDemandQueue
getInstance()
Returns the singleton instance of the sod-queue.static int
getQueueSize()
Returns the current queue size.static void
queue(ScanOnDemandTask task)
Adds a sod-task to the singleton instance's queue.void
queueTask(ScanOnDemandTask task)
Adds a task to the queue.static void
shutdown()
Shuts down the executor(s).protected void
startQueue()
Starts the executor if it hasn't started yet, or updates the thread-pool size if it is started.
-
-
-
Method Detail
-
getInstance
public static ScanOnDemandQueue getInstance()
Returns the singleton instance of the sod-queue.- Returns:
- the instance.
-
getQueueSize
public static int getQueueSize()
Returns the current queue size.- Returns:
- the queue size,
-
queue
public static void queue(ScanOnDemandTask task)
Adds a sod-task to the singleton instance's queue.- Parameters:
task
- the task to do.
-
startQueue
protected void startQueue()
Starts the executor if it hasn't started yet, or updates the thread-pool size if it is started.
-
queueTask
public void queueTask(ScanOnDemandTask task)
Adds a task to the queue.- Parameters:
task
- the task to do.- See Also:
AbstractExecutorService.submit(Runnable)
-
shutdown
public static void shutdown()
Shuts down the executor(s). Gracefully waits forScanOnDemandVariables.getSodWaitForJobShutdownTimeout()
seconds for all jobs to finish before forcefully shutting them down.
-
-