|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.util.concurrent.AbstractHaltableProcess
com.bigdata.service.ndx.pipeline.AbstractMasterTask<H,E,S,L>
com.bigdata.service.ndx.pipeline.AbstractPendingSetMasterTask<H,E,S,L>
com.bigdata.service.jini.master.ResourceBufferTask<H,E,S,L,HS>
H - The generic type of the value returned by Callable.call()
for the master.E - The generic type of the elements in the chunks stored in the
BlockingBuffer.S - The generic type of the subtask implementation class.L - The generic type of the key used to lookup a subtask in the
internal map (must be unique and must implement hashCode() and
equals() per their contracts).HS - The generic type of the value returned by Callable.call()
for the subtask.public abstract class ResourceBufferTask<H extends ResourceBufferStatistics<L,HS>,E extends Serializable,S extends ResourceBufferSubtask,L extends ClientLocator,HS extends ResourceBufferSubtaskStatistics>
Task drains a BlockingBuffer containing resources (really, resource
identifiers) to be processed by the clients and uses hash partitioning to
assign the resources to client tasks for processing.
If the task is interrupted, it will refuse additional writes by closing its
BlockingBuffer and will cancel any sub-tasks and discard any buffered
writes.
| Nested Class Summary | |
|---|---|
static class |
ResourceBufferTask.M<E extends Serializable>
Concrete master hides most of the generic types leaving you with only those that are meaningful to parameterize. |
| Field Summary | |
|---|---|
protected int |
sinkChunkSize
|
protected long |
sinkChunkTimeoutNanos
|
protected int |
sinkQueueCapacity
|
protected MappedTaskMaster |
taskMaster
|
| Fields inherited from class com.bigdata.service.ndx.pipeline.AbstractPendingSetMasterTask |
|---|
log, masterProxy |
| Fields inherited from class com.bigdata.service.ndx.pipeline.AbstractMasterTask |
|---|
buffer, sinkIdleTimeoutNanos, sinkPollTimeoutNanos, src, stats |
| Constructor Summary | |
|---|---|
ResourceBufferTask(MappedTaskMaster taskMaster,
long sinkIdleTimeoutNanos,
long sinkPollTimeoutNanos,
int sinkQueueCapacity,
int sinkChunkSize,
long sinkChunkTimeoutNanos,
H stats,
BlockingBuffer<E[]> buffer)
|
|
| Method Summary | |
|---|---|
protected Map<E,Collection<L>> |
getPendingMap()
Return the pending map. |
protected void |
handleChunk(E[] chunk,
boolean reopen)
Hash partitions the chunk among the clients. |
protected Map<E,Collection<L>> |
newPendingMap()
Return a new pending map instance. |
protected S |
newSubtask(L locator,
BlockingBuffer<E[]> out)
Factory for a new subtask. |
protected BlockingBuffer<E[]> |
newSubtaskBuffer()
Factory for a new buffer for a subtask. |
protected Future<HS> |
submitSubtask(S subtask)
Submit the subtask to an Executor. |
String |
toString()
|
protected void |
willShutdown()
Accelerate shutdown protocol by mapping the pending set across the remaining clients. |
| Methods inherited from class com.bigdata.service.ndx.pipeline.AbstractPendingSetMasterTask |
|---|
addPending, didFail, didSucceed, error, getFederation, getPendingSetSize, nothingPending, removePending, success |
| Methods inherited from class com.bigdata.service.ndx.pipeline.AbstractMasterTask |
|---|
addToOutputBuffer, call, getBuffer, getRedirectQueueSize, getSink, getStats, mapOperationOverSubtasks, moveSinkToFinishedQueueAtomically, notifySubtaskDone, redirectChunk |
| Methods inherited from class com.bigdata.util.concurrent.AbstractHaltableProcess |
|---|
halt, halted |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final MappedTaskMaster taskMaster
protected final int sinkQueueCapacity
protected final int sinkChunkSize
protected final long sinkChunkTimeoutNanos
| Constructor Detail |
|---|
public ResourceBufferTask(MappedTaskMaster taskMaster,
long sinkIdleTimeoutNanos,
long sinkPollTimeoutNanos,
int sinkQueueCapacity,
int sinkChunkSize,
long sinkChunkTimeoutNanos,
H stats,
BlockingBuffer<E[]> buffer)
sinkQueueCapacity - The capacity of the internal queue for the per-sink output
buffer.sinkChunkSize - The desired size of the chunks written that will be written by
the sink.sinkChunkTimeoutNanos - The maximum amount of time in nanoseconds that a sink will
combine smaller chunks so that it can satisfy the desired
sinkChunkSize.| Method Detail |
|---|
protected Map<E,Collection<L>> getPendingMap()
AbstractPendingSetMasterTask
getPendingMap in class AbstractPendingSetMasterTask<H extends ResourceBufferStatistics<L,HS>,E extends Serializable,S extends ResourceBufferSubtask,L extends ClientLocator>public String toString()
toString in class Object
protected void willShutdown()
throws InterruptedException
willShutdown in class AbstractMasterTask<H extends ResourceBufferStatistics<L,HS>,E extends Serializable,S extends ResourceBufferSubtask,L extends ClientLocator>InterruptedException
protected void handleChunk(E[] chunk,
boolean reopen)
throws InterruptedException
handleChunk in class AbstractMasterTask<H extends ResourceBufferStatistics<L,HS>,E extends Serializable,S extends ResourceBufferSubtask,L extends ClientLocator>chunk - A chunk.reopen - When false it is an error if the output buffer
has been closed. When true the output buffer
will be (re-)opened as necessary. This will be
false when invoked by AbstractMasterTask.call() (since
the output buffers are not closed until the master's buffer is
closed) and should be true if you are handling
redirects.
InterruptedException
protected S newSubtask(L locator,
BlockingBuffer<E[]> out)
AbstractMasterTask
newSubtask in class AbstractMasterTask<H extends ResourceBufferStatistics<L,HS>,E extends Serializable,S extends ResourceBufferSubtask,L extends ClientLocator>locator - The unique key for the subtask.out - The BlockingBuffer on which the master will write for
that subtask.
protected BlockingBuffer<E[]> newSubtaskBuffer()
The queue capacity, chunk size and chunk timeout are taken from the ctor parameters.
newSubtaskBuffer in class AbstractMasterTask<H extends ResourceBufferStatistics<L,HS>,E extends Serializable,S extends ResourceBufferSubtask,L extends ClientLocator>protected Future<HS> submitSubtask(S subtask)
AbstractMasterTaskExecutor.
submitSubtask in class AbstractMasterTask<H extends ResourceBufferStatistics<L,HS>,E extends Serializable,S extends ResourceBufferSubtask,L extends ClientLocator>subtask - The subtask.
Future.protected Map<E,Collection<L>> newPendingMap()
AbstractPendingSetMasterTaskBigdataMap may be used if sufficient RAM is not available.
newPendingMap in class AbstractPendingSetMasterTask<H extends ResourceBufferStatistics<L,HS>,E extends Serializable,S extends ResourceBufferSubtask,L extends ClientLocator>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||