public abstract class AbstractPendingSetSubtask<HS extends AbstractSubtaskStats,M extends AbstractPendingSetMasterTask<? extends AbstractPendingSetMasterStats<L,HS>,E,? extends AbstractPendingSetSubtask,L>,E,L> extends AbstractSubtask<HS,M,E,L>
IAsynchronousClientTask, to track the set of outstanding
asynchronous operations for a specific client task (the "pending set"), and
to close the client task when the sink not assign any more work to that
client.| Modifier and Type | Field and Description |
|---|---|
protected IAsynchronousClientTask<?,E> |
clientTask |
buffer, lastChunkAvailableNanos, lastChunkNanos, locator, log, master, src, stats| Constructor and Description |
|---|
AbstractPendingSetSubtask(M master,
L locator,
IAsynchronousClientTask<?,E> clientTask,
BlockingBuffer<E[]> buffer) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
addPending(E e) |
protected void |
awaitPending()
Wait until any asynchronous processing for the subtask is done.
|
protected void |
cancelRemoteTask(boolean mayInterruptIfRunning)
Cancel the remote task.
|
protected abstract Set<E> |
getPendingSet()
Return the pending set.
|
int |
getPendingSetSize() |
protected boolean |
handleChunk(E[] chunk)
Submits the chunk of resources for processing by the remote client task.
|
protected void |
notifyClientOfRedirect(L locator,
Throwable cause)
Notify the client that the locator is stale.
|
protected boolean |
removePending(E e) |
call, handleRedirect, toStringprotected final IAsynchronousClientTask<?,E> clientTask
public AbstractPendingSetSubtask(M master, L locator, IAsynchronousClientTask<?,E> clientTask, BlockingBuffer<E[]> buffer)
clientTask - The proxy for the remote client task.public int getPendingSetSize()
protected final void cancelRemoteTask(boolean mayInterruptIfRunning)
throws InterruptedException
AbstractSubtaskcancelRemoteTask in class AbstractSubtask<HS extends AbstractSubtaskStats,M extends AbstractPendingSetMasterTask<? extends AbstractPendingSetMasterStats<L,HS>,E,? extends AbstractPendingSetSubtask,L>,E,L>InterruptedExceptionprotected final void awaitPending()
throws InterruptedException
AbstractSubtaskawaitPending in class AbstractSubtask<HS extends AbstractSubtaskStats,M extends AbstractPendingSetMasterTask<? extends AbstractPendingSetMasterStats<L,HS>,E,? extends AbstractPendingSetSubtask,L>,E,L>InterruptedExceptionprotected final boolean addPending(E e)
protected final boolean removePending(E e)
protected boolean handleChunk(E[] chunk) throws ExecutionException, InterruptedException, IOException
handleChunk in class AbstractSubtask<HS extends AbstractSubtaskStats,M extends AbstractPendingSetMasterTask<? extends AbstractPendingSetMasterStats<L,HS>,E,? extends AbstractPendingSetSubtask,L>,E,L>chunk - A chunk of resources to be processed.true iff the client will not accept additional
chunks.IOException - RMI error.ExecutionExceptionInterruptedExceptionprotected void notifyClientOfRedirect(L locator, Throwable cause)
AbstractSubtasknotifyClientOfRedirect in class AbstractSubtask<HS extends AbstractSubtaskStats,M extends AbstractPendingSetMasterTask<? extends AbstractPendingSetMasterStats<L,HS>,E,? extends AbstractPendingSetSubtask,L>,E,L>locator - The locator.cause - The cause.awaitPending() which might have to poll the future
of the client to make sure that it is still alive (or check w/ zk
but zk can disconnect clients overly eagerly)., This class ALSO needs to handle the resubmit of the resources
associated with the current submit. That will occur only when the
remote client task dies while invoking client#accept(chunk). The
AbstractPendingSetMasterTask needs to start a new client
task for the given ClientLocator, ideally on a different
IRemoteExecutor service. If there is no such available
service then it could multiplex multiple client#s onto the same
client, essentially doubling the load for some client. Or we could
hash partition based on the #of remaining clients, which would
distribute the load evenly over the remaining clients.Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.