public abstract class ThreadedWorker<T> extends Object
| Constructor and Description |
|---|
ThreadedWorker()
Basic constructor.
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
doWork(T workItem) |
WorkCompleteListener<T> |
getListener()
Return the listener notified upon completion.
|
Integer |
getMaxThreads()
Return the maximum number of parallel threads allowed.
|
boolean |
isComplete()
The work is complete if there's no queued work and all threads are
inactive.
|
void |
push(T workItem)
Push a new work item in the queue, ready to be processed.
|
void |
setListener(WorkCompleteListener<T> listener)
Set the listener to be notified when all items are completed.
|
void |
setMaxThreads(Integer maxThreads)
Set the maximum number of parallel threads allowed.
|
void |
startWorking() |
public void push(T workItem)
workItem - The work item to pushpublic void startWorking()
public boolean isComplete()
public Integer getMaxThreads()
public void setMaxThreads(Integer maxThreads)
maxThreads - the maximum number of threads.public WorkCompleteListener<T> getListener()
public void setListener(WorkCompleteListener<T> listener)
listener - the listener.Copyright © 2017. All Rights Reserved.