|
ehcache | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.ehcache.constructs.refreshahead.ThreadedWorkQueue<W>
W - public class ThreadedWorkQueue<W>
This class implements a work queue of pooled objects. You can offer a stream of objects to the backing poool of threads and it will consume them and hand them to the BatchWorker as a collection to be processed (batched).
Essentially, it uses BatchWorker as Callable/Future with a collection argument.
| Nested Class Summary | |
|---|---|
static interface |
ThreadedWorkQueue.BatchWorker<WW>
Callback class, think of it as a Runnable with an argument that is a Collection. |
| Constructor Summary | |
|---|---|
ThreadedWorkQueue(ThreadedWorkQueue.BatchWorker<W> dispatcher,
int numberOfThreads,
ThreadFactory factory,
int maximumQueueSize,
int batchSize)
Create a work queue where work is dispatched through the given dispatcher, which the specified number of threads. |
|
| Method Summary | |
|---|---|
long |
getBacklogCount()
Get the current backlog count. |
int |
getBatchSize()
Get the batch size |
ThreadedWorkQueue.BatchWorker<W> |
getDispatcher()
get the dispatcher being used for this queue. |
int |
getDroppedCount()
Gets dropped counter. |
int |
getOfferedCount()
Gets offer counter. |
int |
getProcessedCount()
Gets processed count. |
boolean |
isAlive()
Is this work queue still accepting work. |
void |
offer(W workUnit)
Offer a work unit to queue. |
void |
shutdown()
Shutdown this queue. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ThreadedWorkQueue(ThreadedWorkQueue.BatchWorker<W> dispatcher,
int numberOfThreads,
ThreadFactory factory,
int maximumQueueSize,
int batchSize)
dispatcher - Thread safe dispatcher to use to dispatch worknumberOfThreads - Number of parallel threads used process work from this queuefactory - ThreadFactory used to create the threadsmaximumQueueSize - maximum backlog of work items that can be queued before items get droppedbatchSize - number of items, at a maximum, to send to a dispatcher at a time.| Method Detail |
|---|
public void offer(W workUnit)
workUnit - public boolean isAlive()
public long getBacklogCount()
public int getOfferedCount()
public int getDroppedCount()
public int getProcessedCount()
public ThreadedWorkQueue.BatchWorker<W> getDispatcher()
public int getBatchSize()
public void shutdown()
ThreadedWorkQueue.BatchWorker threads.
|
ehcache | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||