VIBE v5.1.6
Search Engine
Loading...
Searching...
No Matches
edu.usfca.cs272.WorkQueue Class Reference

Public Member Functions

 WorkQueue ()
 
 WorkQueue (int threads)
 
void execute (Runnable task)
 
synchronized void finish ()
 
void shutdown ()
 
void join ()
 
int size ()
 

Static Public Attributes

static final int DEFAULT = 5
 

Detailed Description

A simple work queue.

Author
CS 272 Software Development (University of San Francisco)
Ravneet Singh Bhatia

Constructor & Destructor Documentation

◆ 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
threadsnumber of worker threads to use.

Member Function Documentation

◆ execute()

void edu.usfca.cs272.WorkQueue.execute ( Runnable task)

Adds a task request to the queue.

Parameters
tasktask request.

◆ 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.

Member Data Documentation

◆ 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: