W
- public class ThreadedWorkQueue<W> extends Object
Essentially, it uses BatchWorker as Callable/Future with a collection argument.
Modifier and Type | Class and Description |
---|---|
static interface |
ThreadedWorkQueue.BatchWorker<WW>
Callback class, think of it as a Runnable with an argument that is
a
Collection . |
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.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.Copyright © 2003–2016 Terracotta, Inc.. All rights reserved.