public class ClientRequestScheduler extends java.lang.Object implements RequestScheduler
| Modifier and Type | Field and Description |
|---|---|
ClientContext |
clientContext |
java.lang.String |
name |
static java.lang.String |
PRIORITY_HARD |
static java.lang.String |
PRIORITY_NONE |
static java.lang.String |
PRIORITY_SOFT |
COOLDOWN_PERIOD, COOLDOWN_RETRIES| Constructor and Description |
|---|
ClientRequestScheduler(boolean forInserts,
boolean forSSKs,
boolean forRT,
RandomSource random,
RequestStarter starter,
Node node,
NodeClientCore core,
java.lang.String name,
ClientContext context) |
| 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 e,
int prio,
boolean persistent) |
long |
countPersistentWaitingKeys() |
long |
countQueuedRequests() |
void |
dequeueOfferedKey(Key key) |
KeysFetchingLocally |
fetchingKeys() |
java.lang.String |
getChoosenPriorityScheduler() |
ClientContext |
getContext() |
KeySalter |
getGlobalKeySalter(boolean persistent) |
ClientRequestSelector |
getSelector() |
ChosenBlock |
grabRequest()
Called by RequestStarter to find a request to run.
|
boolean |
hasFetchingKey(Key key,
BaseSendableGet getterWaiting,
boolean persistent)
Check whether a key is already being fetched.
|
boolean |
isInsertScheduler() |
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 |
queueOfferedKey(Key key,
boolean realTime)
Queue the offered key
|
void |
register(HasKeyListener hasListener,
SendableGet[] getters,
boolean persistent,
BlockSet blocks,
boolean noCheckStore)
Register a group of requests (not inserts): a GotKeyListener and/or one
or more SendableGet's.
|
void |
registerInsert(SendableRequest req,
boolean persistent) |
void |
removeFetchingKey(Key key) |
void |
removePendingKeys(HasKeyListener getter,
boolean complain)
Remove a KeyListener from the list of KeyListeners.
|
void |
removePendingKeys(KeyListener getter,
boolean complain)
Remove a KeyListener from the list of KeyListeners.
|
void |
removeRunningInsert(SendableInsert insert,
SendableRequestItemKey token) |
void |
removeRunningRequest(SendableRequest request) |
void |
reregisterAll(ClientRequester request,
short oldPrio) |
byte[] |
saltKey(boolean persistent,
Key key) |
void |
setPriorityScheduler(java.lang.String val)
Called by the config.
|
void |
startCore(byte[] globalSaltPersistent) |
void |
succeeded(BaseSendableGet succeeded,
boolean persistent)
Tell the scheduler that a request from a specific RandomGrabArray succeeded.
|
void |
tripPendingKey(KeyBlock block) |
void |
wakeStarter() |
boolean |
wantKey(Key key) |
public final java.lang.String name
public final ClientContext clientContext
public static final java.lang.String PRIORITY_NONE
public static final java.lang.String PRIORITY_SOFT
public static final java.lang.String PRIORITY_HARD
public ClientRequestScheduler(boolean forInserts,
boolean forSSKs,
boolean forRT,
RandomSource random,
RequestStarter starter,
Node node,
NodeClientCore core,
java.lang.String name,
ClientContext context)
public void startCore(byte[] globalSaltPersistent)
public void setPriorityScheduler(java.lang.String val)
val - public void registerInsert(SendableRequest req, boolean persistent)
public void register(HasKeyListener hasListener, SendableGet[] getters, boolean persistent, BlockSet blocks, boolean noCheckStore)
hasListener - Listens for specific keys. Can be null if the listener
is already registered i.e. on retrying.getters - The actual requests to register to the request sender queue.persistent - True if the request is persistent.onDatabaseThread - True if we are running on the database thread.
NOTE: delayedStoreCheck/probablyNotInStore is unnecessary because we only
register the listener once.FetchExceptionpublic void removeRunningRequest(SendableRequest request)
removeRunningRequest in interface RequestSchedulerpublic boolean isRunningOrQueuedPersistentRequest(SendableRequest request)
RequestSchedulerisRunningOrQueuedPersistentRequest in interface RequestSchedulerpublic ChosenBlock grabRequest()
grabRequest in interface RequestSchedulerpublic void removePendingKeys(KeyListener getter, boolean complain)
getter - complain - public void removePendingKeys(HasKeyListener getter, boolean complain)
getter - complain - public void reregisterAll(ClientRequester request, short oldPrio)
public java.lang.String getChoosenPriorityScheduler()
public void succeeded(BaseSendableGet succeeded, boolean persistent)
RequestSchedulersucceeded in interface RequestSchedulersucceeded - The request we ran, which must be deleted.public void tripPendingKey(KeyBlock block)
public boolean wantKey(Key key)
wantKey in interface RequestSchedulerpublic void queueOfferedKey(Key key, boolean realTime)
public void dequeueOfferedKey(Key key)
public long countQueuedRequests()
countQueuedRequests in interface RequestSchedulerpublic KeysFetchingLocally fetchingKeys()
fetchingKeys in interface RequestSchedulerpublic void removeFetchingKey(Key key)
removeFetchingKey in interface RequestSchedulerpublic void removeRunningInsert(SendableInsert insert, SendableRequestItemKey token)
removeRunningInsert in interface RequestSchedulerpublic void callFailure(SendableGet get, LowLevelGetException e, int prio, boolean persistent)
callFailure in interface RequestSchedulerpublic void callFailure(SendableInsert insert, LowLevelPutException e, int prio, boolean persistent)
callFailure in interface RequestSchedulerpublic ClientContext getContext()
getContext in interface RequestSchedulerpublic boolean addToFetching(Key key)
addToFetching in interface RequestSchedulerpublic boolean addRunningInsert(SendableInsert insert, SendableRequestItemKey token)
addRunningInsert in interface RequestSchedulerpublic boolean hasFetchingKey(Key key, BaseSendableGet getterWaiting, boolean persistent)
RequestSchedulerhasFetchingKey in interface RequestSchedulerpublic long countPersistentWaitingKeys()
public boolean isInsertScheduler()
public void wakeStarter()
wakeStarter in interface RequestSchedulerpublic byte[] saltKey(boolean persistent,
Key key)
public KeySalter getGlobalKeySalter(boolean persistent)
public ClientRequestSelector getSelector()
getSelector in interface RequestScheduler