|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.android.builder.tasks.WorkQueue<T>
public class WorkQueue<T>
A work queue that accepts jobs and treat them in order.
Constructor Summary | |
---|---|
WorkQueue(com.android.utils.ILogger logger,
QueueThreadContext<T> queueThreadContext,
java.lang.String queueName,
int workforce,
int growthTriggerRatio)
Creates a new queue, with a number of dedicated threads to process the queue's jobs. |
Method Summary | |
---|---|
java.lang.String |
getName()
Return a human readable queue name, mainly used for identification purposes. |
void |
push(Job<T> job)
|
void |
run()
each thread in the mWorkThreads will run this single infinite processing loop until a death action is received. |
void |
shutdown()
Shutdowns the working queue and wait until all pending requests have been processed. |
int |
size()
Returns the number of jobs waiting to be scheduled. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WorkQueue(@NonNull com.android.utils.ILogger logger, @NonNull QueueThreadContext<T> queueThreadContext, @NonNull java.lang.String queueName, int workforce, int growthTriggerRatio)
logger
- to log messagesqueueName
- a meaningful descriptive name.workforce
- the number of dedicated threads for this queue.growthTriggerRatio
- the ratio between outstanding requests and worker threads that
should trigger a growth in worker threads.Method Detail |
---|
public void push(Job<T> job) throws java.lang.InterruptedException
java.lang.InterruptedException
public void shutdown() throws java.lang.InterruptedException
java.lang.InterruptedException
- if the shutdown sequence is interruptedpublic java.lang.String getName()
public int size()
public void run()
run
in interface java.lang.Runnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |