public interface CheckpointSpi extends IgniteSpi
Note, that since a job can execute on different nodes, checkpoints need to be accessible by all nodes.
To manipulate checkpoints from grid job the following public methods are available on task session (that can be injected into grid job):
ComputeTaskSession.saveCheckpoint(String, Object, org.apache.ignite.compute.ComputeTaskSessionScope, long)
ComputeTaskSession.saveCheckpoint(String, Object, org.apache.ignite.compute.ComputeTaskSessionScope, long, boolean)
Ignite provides the following
Ignite.configuration()method to check its configuration properties or call other non-SPI methods. Note again that calling methods from this interface on the obtained instance can lead to undefined behavior and explicitly not supported.
|Modifier and Type||Method and Description|
Loads checkpoint from storage by its unique key.
This method instructs the checkpoint provider to clean saved data for a given
Saves checkpoint to the storage.
Sets the checkpoint listener.
@Nullable @Nullable byte loadCheckpoint(String key) throws IgniteSpiException
key- Checkpoint key.
nullif there is no data for a given key.
IgniteSpiException- Thrown in case of any error while loading checkpoint data. Note that in case when given
keyis not found this method will return
boolean saveCheckpoint(String key, byte state, long timeout, boolean overwrite) throws IgniteSpiException
key- Checkpoint unique key.
state- Saved data.
timeout- Every intermediate data stored by checkpoint provider should have a timeout. Timeout allows for effective resource management by checkpoint provider by cleaning saved data that are not needed anymore. Generally, the user should choose the minimum possible timeout to avoid long-term resource acquisition by checkpoint provider. Value
0means that timeout will never expire.
overwrite- Whether or not overwrite checkpoint if it already exists.
trueif checkpoint has been actually saved,
IgniteSpiException- Thrown in case of any error while saving checkpoint data.
boolean removeCheckpoint(String key)
key- Key for the checkpoint to remove.
trueif data has been actually removed,
void setCheckpointListener(CheckpointListener lsnr)
lsnr- The listener to set or