public interface RequestScheduler
Modifier and Type | Field and Description |
---|---|
static long |
COOLDOWN_PERIOD
Once a key has been requested a few times, don't request it again for 30 minutes.
|
static int |
COOLDOWN_RETRIES
The number of times a key can be requested before triggering the cooldown period.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addRunningInsert(SendableInsert insert,
SendableRequestItemKey token) |
boolean |
addToFetching(Key key) |
void |
callFailure(SendableGet get,
LowLevelGetException e,
int prio,
boolean persistent) |
void |
callFailure(SendableInsert insert,
LowLevelPutException exception,
int prio,
boolean persistent) |
long |
countQueuedRequests() |
KeysFetchingLocally |
fetchingKeys() |
ClientContext |
getContext() |
ClientRequestSelector |
getSelector() |
ChosenBlock |
grabRequest() |
boolean |
hasFetchingKey(Key key,
BaseSendableGet getterWaiting,
boolean persistent)
Check whether a key is already being fetched.
|
boolean |
isRunningOrQueuedPersistentRequest(SendableRequest request)
This only works for persistent requests, because transient requests are not
selected on a SendableRequest level, they are selected on a {SendableRequest, token} level.
|
void |
removeFetchingKey(Key key) |
void |
removeRunningInsert(SendableInsert insert,
SendableRequestItemKey token) |
void |
removeRunningRequest(SendableRequest request) |
void |
succeeded(BaseSendableGet get,
boolean persistent)
Tell the scheduler that a request from a specific RandomGrabArray succeeded.
|
void |
wakeStarter() |
boolean |
wantKey(Key key) |
static final long COOLDOWN_PERIOD
static final int COOLDOWN_RETRIES
void succeeded(BaseSendableGet get, boolean persistent)
get
- The request we ran, which must be deleted.persistent
- long countQueuedRequests()
KeysFetchingLocally fetchingKeys()
void removeFetchingKey(Key key)
void callFailure(SendableGet get, LowLevelGetException e, int prio, boolean persistent)
void callFailure(SendableInsert insert, LowLevelPutException exception, int prio, boolean persistent)
ClientContext getContext()
boolean addToFetching(Key key)
ChosenBlock grabRequest()
void removeRunningRequest(SendableRequest request)
boolean isRunningOrQueuedPersistentRequest(SendableRequest request)
boolean hasFetchingKey(Key key, BaseSendableGet getterWaiting, boolean persistent)
key
- getterWaiting
- persistent
- boolean addRunningInsert(SendableInsert insert, SendableRequestItemKey token)
void removeRunningInsert(SendableInsert insert, SendableRequestItemKey token)
void wakeStarter()
boolean wantKey(Key key)
ClientRequestSelector getSelector()