Package org.apache.ignite.spi.checkpoint
Interface CheckpointSpi
- 
- All Superinterfaces:
- IgniteSpi
 - All Known Implementing Classes:
- CacheCheckpointSpi,- JdbcCheckpointSpi,- NoopCheckpointSpi,- SharedFsCheckpointSpi
 
 public interface CheckpointSpi extends IgniteSpi Checkpoint SPI provides an ability to save an intermediate job state. It can be useful when long running jobs need to store some intermediate state to protect from system or application failures. Grid job can save intermediate state in certain points of the execution (e.g., periodically) and upon start check if previously saved state exists. This allows job to restart from the last save checkpoint in case of preemption or other types of failover.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 GridCheckpointSpiimplementations:- NoopCheckpointSpi- default
- SharedFsCheckpointSpi
- 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.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description @org.jetbrains.annotations.Nullable byte[]loadCheckpoint(String key)Loads checkpoint from storage by its unique key.booleanremoveCheckpoint(String key)This method instructs the checkpoint provider to clean saved data for a givenkey.booleansaveCheckpoint(String key, byte[] state, long timeout, boolean overwrite)Saves checkpoint to the storage.voidsetCheckpointListener(CheckpointListener lsnr)Sets the checkpoint listener.- 
Methods inherited from interface org.apache.ignite.spi.IgniteSpigetName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized, spiStart, spiStop
 
- 
 
- 
- 
- 
Method Detail- 
loadCheckpoint@Nullable @org.jetbrains.annotations.Nullable byte[] loadCheckpoint(String key) throws IgniteSpiException Loads checkpoint from storage by its unique key.- Parameters:
- key- Checkpoint key.
- Returns:
- Loaded data or nullif there is no data for a given key.
- Throws:
- IgniteSpiException- Thrown in case of any error while loading checkpoint data. Note that in case when given- keyis not found this method will return- null.
 
 - 
saveCheckpointboolean saveCheckpoint(String key, byte[] state, long timeout, boolean overwrite) throws IgniteSpiException Saves checkpoint to the storage.- Parameters:
- 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.
- Returns:
- trueif checkpoint has been actually saved,- falseotherwise.
- Throws:
- IgniteSpiException- Thrown in case of any error while saving checkpoint data.
 
 - 
removeCheckpointboolean removeCheckpoint(String key) This method instructs the checkpoint provider to clean saved data for a givenkey.- Parameters:
- key- Key for the checkpoint to remove.
- Returns:
- trueif data has been actually removed,- falseotherwise.
 
 - 
setCheckpointListenervoid setCheckpointListener(CheckpointListener lsnr) Sets the checkpoint listener.- Parameters:
- lsnr- The listener to set or- null.
 
 
- 
 
-