public class CooldownBlockChooser extends SimpleBlockChooser
maxRetries
Constructor and Description |
---|
CooldownBlockChooser(int blocks,
java.util.Random random,
int maxRetries,
int cooldownTries,
long cooldownTime) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkValid(int blockNo)
Is the proposed block valid? Override to implement custom logic e.g.
|
int |
chooseKey()
Choose a key to fetch, taking into account retries
|
void |
clearCooldown()
Should be called e.g.
|
long |
getCooldownTime(int blockNumber) |
protected int |
innerOnNonFatalFailure(int blockNo)
Notify when a block has failed.
|
void |
onUnSuccess(int blockNo)
Notify that a block has no longer succeeded.
|
long |
overallCooldownTime() |
copyDownloadedBlocks, countFailedBlocks, countFetchable, getBlockNumber, getMaxBlockNumber, getRetries, hasSucceeded, hasSucceededAll, onCompletedAll, onNonFatalFailure, onSuccess, read, readRetries, replaceSuccesses, successCount, write, writeRetries
public CooldownBlockChooser(int blocks, java.util.Random random, int maxRetries, int cooldownTries, long cooldownTime)
public int chooseKey()
SimpleBlockChooser
chooseKey
in class SimpleBlockChooser
protected boolean checkValid(int blockNo)
SimpleBlockChooser
checkValid
in class SimpleBlockChooser
protected int innerOnNonFatalFailure(int blockNo)
SimpleBlockChooser
innerOnNonFatalFailure
in class SimpleBlockChooser
public final void clearCooldown()
public void onUnSuccess(int blockNo)
SimpleBlockChooser
onUnSuccess
in class SimpleBlockChooser
public long overallCooldownTime()
public long getCooldownTime(int blockNumber)