A simple work queue.
- Author
- CS 272 Software Development (University of San Francisco)
-
Ravneet Singh Bhatia
◆ WorkQueue() [1/2]
edu.usfca.cs272.WorkQueue.WorkQueue |
( |
| ) |
|
Starts a work queue with default number of threads.
◆ WorkQueue() [2/2]
edu.usfca.cs272.WorkQueue.WorkQueue |
( |
int | threads | ) |
|
Starts a work queue with given number of threads.
- Parameters
-
threads | number of worker threads to use. |
◆ execute()
void edu.usfca.cs272.WorkQueue.execute |
( |
Runnable | task | ) |
|
Adds a task request to the queue.
- Parameters
-
◆ finish()
synchronized void edu.usfca.cs272.WorkQueue.finish |
( |
| ) |
|
Waits for all the pending work to be finished. Does not terminate the worker threads.
◆ join()
void edu.usfca.cs272.WorkQueue.join |
( |
| ) |
|
Waits for all the work to be finished and the worker threads to terminate. The work queue cannot be reused after this call completes.
◆ shutdown()
void edu.usfca.cs272.WorkQueue.shutdown |
( |
| ) |
|
Asks the work queue to shutdown. Any tasks left in the queue will not be completed.
◆ size()
int edu.usfca.cs272.WorkQueue.size |
( |
| ) |
|
Return the number of worker threads being used by the work queue.
- Returns
- the number of worker threads.
◆ DEFAULT
final int edu.usfca.cs272.WorkQueue.DEFAULT = 5 |
|
static |
Default number of worker threads to use.
The documentation for this class was generated from the following file:
- C:/USFCS/CS272/projects/project-Ravneetsb/src/main/java/edu/usfca/cs272/WorkQueue.java