...
Code Block | ||
---|---|---|
| ||
public void setStateRestoreListener(final StateRestoreListener stateRestoreListener) |
Default Implementations
As a convenience for users wanting to leverage the StaterRestoreListener
for state store callbacks as part of this KIP we'll also add the following abstract classes:
For single action state restoration there is AbstractNotifyingRestoreCallback
Code Block |
---|
public abstract class AbstractNotifyingRestoreCallback implements StateRestoreCallback, StateRestoreListener {
@Override
public void onRestoreStart(String storeName, long startingOffset, long endingOffset) {
}
@Override
public void onBatchRestored(String storeName, long batchEndOffset, long numRestored) {
}
@Override
public void onRestoreEnd(String storeName, long totalRestored) {
}
} |
For the corresponding bulk action state restoration we have AbstractBatchingRestoreCallback
Code Block |
---|
public abstract class AbstractBatchingRestoreCallback implements BatchingStateRestoreCallback, StateRestoreListener {
@Override
public void restore(byte[] key, byte[] value) {
throw new UnsupportedOperationException("Single restore not supported");
}
@Override
public void onRestoreStart(String storeName, long startingOffset, long endingOffset) {
}
@Override
public void onBatchRestored(String storeName, long batchEndOffset, long numRestored) {
}
@Override
public void onRestoreEnd(String storeName, long totalRestored) {
}
} |
StateRestoreListener Use Cases
...