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.loadCheckpoint(String)
ComputeTaskSession.removeCheckpoint(String)
ComputeTaskSession.saveCheckpoint(String, Object)
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 GridCheckpointSpi
implementations:
NoopCheckpointSpi
- defaultSharedFsCheckpointSpi
S3CheckpointSpi
JdbcCheckpointSpi
CacheCheckpointSpi
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 |
---|---|
byte[] |
loadCheckpoint(String key)
Loads checkpoint from storage by its unique key.
|
boolean |
removeCheckpoint(String key)
This method instructs the checkpoint provider to clean saved data for a
given
key . |
boolean |
saveCheckpoint(String key,
byte[] state,
long timeout,
boolean overwrite)
Saves checkpoint to the storage.
|
void |
setCheckpointListener(CheckpointListener lsnr)
Sets the checkpoint listener.
|
getName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized, spiStart, spiStop
byte[] loadCheckpoint(String key) throws IgniteSpiException
key
- Checkpoint key.null
if 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 key
is not
found this method will return null
.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 0
means that timeout will never expire.overwrite
- Whether or not overwrite checkpoint if it already exists.true
if checkpoint has been actually saved, false
otherwise.IgniteSpiException
- Thrown in case of any error while saving
checkpoint data.boolean removeCheckpoint(String key)
key
.key
- Key for the checkpoint to remove.true
if data has been actually removed, false
otherwise.void setCheckpointListener(CheckpointListener lsnr)
lsnr
- The listener to set or null
.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024