public abstract class BaseSingleFileFetcher extends SendableGet implements HasKeyListener
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
cancelled |
long |
cooldownWakeupTime |
protected FetchContext |
ctx |
protected boolean |
deleteFetchContext |
protected boolean |
finished |
protected ClientKey |
key |
parentparentGrabArray, persistent, realTimeFlag| Modifier | Constructor and Description |
|---|---|
protected |
BaseSingleFileFetcher(ClientKey key,
int maxRetries,
FetchContext ctx,
ClientRequester parent,
boolean deleteFetchContext,
boolean realTimeFlag) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel(ClientContext context) |
SendableRequestItem |
chooseKey(KeysFetchingLocally fetching,
ClientContext context)
Choose a key to fetch.
|
long |
countAllKeys(ClientContext context)
All key identifiers.
|
long |
countSendableKeys(ClientContext context)
All key identifiers currently eligible to be sent.
|
RequestClient |
getClient()
Get client context object.
|
ClientRequester |
getClientRequest()
Get the ClientRequest.
|
FetchContext |
getContext()
Get the fetch context (settings) object.
|
long |
getCooldownWakeup(SendableRequestItem token,
ClientContext context)
Get the time at which the key specified by the given token will wake up from the
cooldown queue.
|
ClientKey |
getKey(SendableRequestItem token)
Get a numbered key to fetch.
|
short |
getPriorityClass()
Get the priority class of the request.
|
SendableGet |
getRequest(Key key) |
long |
getWakeupTime(ClientContext context,
long now)
Unless this is a RandomGrabArrayItem, this will return the wakeup time for the subtree
rooted at this node.
|
boolean |
isCancelled()
If true, the request has been cancelled, or has completed, either way it need not
be registered any more.
|
boolean |
isEmpty() |
boolean |
isSSK()
Is this an SSK? For purposes of determining which scheduler to use.
|
Key[] |
listKeys()
What keys are we interested in? For purposes of checking the datastore.
|
KeyListener |
makeKeyListener(ClientContext context,
boolean onStartup)
Create a KeyListener, a transient object used to determine which keys we
want, and to handle any blocks found.
|
protected abstract void |
notFoundInStore(ClientContext context) |
protected abstract void |
onBlockDecodeError(SendableRequestItem token,
ClientContext context) |
void |
onChangedFetchContext(ClientContext context)
Reread the cached cooldown values (and anything else) from the FetchContext
after it changes.
|
protected void |
onEnterFiniteCooldown(ClientContext context) |
void |
onGotKey(Key key,
KeyBlock block,
ClientContext context) |
void |
onResume(ClientContext context) |
abstract void |
onSuccess(ClientKeyBlock block,
boolean fromStore,
java.lang.Object token,
ClientContext context)
Called when/if the low-level request succeeds.
|
void |
onSuccess(KeyBlock lowLevelBlock,
boolean fromStore,
SendableRequestItem token,
ClientContext context) |
boolean |
preRegister(ClientContext context,
boolean toNetwork)
Called after checking the datastore and before registering the request to be
sent.
|
void |
reschedule(ClientContext context) |
protected boolean |
retry(ClientContext context)
Try again - returns true if we can retry
|
void |
schedule(ClientContext context) |
void |
unregister(ClientContext context,
short oldPrio)
Unregister the request.
|
void |
unregisterAll(ClientContext context)
Remove the pendingKeys item and then remove from the queue as well.
|
clearWakeupTime, getClientGetState, getNodeKey, getScheduler, getSender, internalError, isInsert, onFailure, reduceWakeupTime, translateExceptiongetParentGrabArray, getSchedulerGroup, hashCode, knowsParentGrabArray, objectToString, persistent, realTimeFlag, setParentGrabArrayprotected final ClientKey key
protected boolean cancelled
protected boolean finished
protected final FetchContext ctx
protected boolean deleteFetchContext
public transient long cooldownWakeupTime
protected BaseSingleFileFetcher(ClientKey key, int maxRetries, FetchContext ctx, ClientRequester parent, boolean deleteFetchContext, boolean realTimeFlag)
public long countAllKeys(ClientContext context)
SendableRequestcountAllKeys in class SendableRequestpublic long countSendableKeys(ClientContext context)
SendableRequestcountSendableKeys in class SendableRequestpublic SendableRequestItem chooseKey(KeysFetchingLocally fetching, ClientContext context)
SendableRequestchooseKey in class SendableRequestpublic ClientKey getKey(SendableRequestItem token)
SendableGetgetKey in class SendableGetpublic FetchContext getContext()
SendableGetgetContext in class SendableGetpublic boolean isSSK()
SendableRequestisSSK in class SendableRequestprotected boolean retry(ClientContext context)
protected void onEnterFiniteCooldown(ClientContext context)
public ClientRequester getClientRequest()
SendableRequestgetClientRequest in class SendableRequestpublic short getPriorityClass()
SendableRequestgetPriorityClass in class SendableRequestpublic void cancel(ClientContext context)
public void unregisterAll(ClientContext context)
public void unregister(ClientContext context, short oldPrio)
SendableRequestunregister in class SendableGetoldPrio - If we are changing priorities it can matter what the old priority is.
However the parent method, SendableRequest, ignores this. In any case,
(short)-1 means not specified (look it up).public boolean isCancelled()
SendableRequestisCancelled in interface HasKeyListenerisCancelled in class SendableRequestpublic boolean isEmpty()
public RequestClient getClient()
SendableRequestgetClient in class SendableRequestpublic void onGotKey(Key key, KeyBlock block, ClientContext context)
public void onSuccess(KeyBlock lowLevelBlock, boolean fromStore, SendableRequestItem token, ClientContext context)
protected abstract void onBlockDecodeError(SendableRequestItem token, ClientContext context)
public abstract void onSuccess(ClientKeyBlock block, boolean fromStore, java.lang.Object token, ClientContext context)
public long getCooldownWakeup(SendableRequestItem token, ClientContext context)
SendableGetgetCooldownWakeup in class SendableGetpublic void schedule(ClientContext context)
public void reschedule(ClientContext context)
public SendableGet getRequest(Key key)
public Key[] listKeys()
SendableGetlistKeys in class SendableGetpublic KeyListener makeKeyListener(ClientContext context, boolean onStartup)
HasKeyListenermakeKeyListener in interface HasKeyListenerprotected abstract void notFoundInStore(ClientContext context)
public boolean preRegister(ClientContext context, boolean toNetwork)
BaseSendableGetpreRegister in class BaseSendableGettoNetwork - If true, we are actually going to send requests (unless we
cancel in this callback). If false, we completed all the work assigned.public long getWakeupTime(ClientContext context, long now)
RequestSelectionTreeNodegetWakeupTime in interface RequestSelectionTreeNodegetWakeupTime in interface RandomGrabArrayItempublic void onChangedFetchContext(ClientContext context)
context - The context object.public void onResume(ClientContext context)