Class CacheCheckpointSpi
- java.lang.Object
- 
- org.apache.ignite.spi.IgniteSpiAdapter
- 
- org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi
 
 
- 
- All Implemented Interfaces:
- CheckpointSpi,- IgniteSpi
 
 @IgniteSpiMultipleInstancesSupport(true) public class CacheCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi This class defines cache-based implementation for checkpoint SPI.ConfigurationMandatoryThis SPI has no mandatory configuration parameters.OptionalThis SPI has following optional configuration parameters:- Cache name (see setCacheName(String))
 Java ExampleCacheCheckpointSpican be configured as follows:IgniteConfiguration cfg = new IgniteConfiguration(); String cacheName = "checkpoints"; GridCacheConfiguration cacheConfig = new GridCacheConfiguration(); cacheConfig.setName(cacheName); GridCacheCheckpointSpi spi = new GridCacheCheckpointSpi(); spi.setCacheName(cacheName); cfg.setCacheConfiguration(cacheConfig); // Override default checkpoint SPI. cfg.setCheckpointSpi(cpSpi); // Start grid. G.start(cfg); Spring ExampleCacheCheckpointSpican be configured from Spring XML configuration file:<bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true"> ... <!-- Cache configuration. --> <property name="cacheConfiguration"> <list> <bean class="org.apache.ignite.cache.CacheConfiguration"> <property name="name" value="CACHE_NAME"/> </bean> </list> </property> <!-- SPI configuration. --> <property name="checkpointSpi"> <bean class="org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi"> <property name="cacheName" value="CACHE_NAME"/> </bean> </property> ... </bean>  
 For information about Spring framework visit www.springframework.org- See Also:
- CheckpointSpi
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringDFLT_CACHE_NAMEDefault cache name (value is checkpoints).- 
Fields inherited from class org.apache.ignite.spi.IgniteSpiAdapterignite, igniteInstanceName
 
- 
 - 
Constructor SummaryConstructors Constructor Description CacheCheckpointSpi()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCacheName()Gets cache name to be used by this SPI..@org.jetbrains.annotations.Nullable byte[]loadCheckpoint(String key)Loads checkpoint from storage by its unique key.protected voidonContextDestroyed0()Method to be called in the beginning of onContextDestroyed() method.protected voidonContextInitialized0(IgniteSpiContext spiCtx)Method to be called in the end of onContextInitialized method.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.CacheCheckpointSpisetCacheName(String cacheName)Sets cache name to be used by this SPI.voidsetCheckpointListener(CheckpointListener lsnr)Sets the checkpoint listener.CacheCheckpointSpisetName(String name)Sets SPI name.voidspiStart(@Nullable String igniteInstanceName)This method is called to start SPI.voidspiStop()This method is called to stop SPI.StringtoString()- 
Methods inherited from class org.apache.ignite.spi.IgniteSpiAdapteraddTimeoutObject, assertParameter, checkConfigurationConsistency0, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getLocalNode, getName, getNodeAttributes, getSpiContext, ignite, initFailureDetectionTimeout, injectables, injectResources, isNodeStopping, onBeforeStart, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized, registerMBean, removeTimeoutObject, started, startInfo, startStopwatch, stopInfo, unregisterMBean
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.apache.ignite.spi.IgniteSpigetName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized
 
- 
 
- 
- 
- 
Field Detail- 
DFLT_CACHE_NAMEpublic static final String DFLT_CACHE_NAME Default cache name (value is checkpoints).- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
setCacheName@IgniteSpiConfiguration(optional=true) public CacheCheckpointSpi setCacheName(String cacheName) Sets cache name to be used by this SPI.If cache name is not provided DFLT_CACHE_NAMEis used.- Parameters:
- cacheName- Cache name.
- Returns:
- thisfor chaining.
 
 - 
getCacheNamepublic String getCacheName() Gets cache name to be used by this SPI..- Returns:
- Cache name to be used by this SPI.
 
 - 
spiStartpublic void spiStart(@Nullable @Nullable String igniteInstanceName) throws IgniteSpiExceptionThis method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.- Specified by:
- spiStartin interface- IgniteSpi
- Parameters:
- igniteInstanceName- Name of Ignite instance this SPI is being started for (- nullfor default Ignite instance).
- Throws:
- IgniteSpiException- Throws in case of any error during SPI start.
 
 - 
onContextInitialized0protected void onContextInitialized0(IgniteSpiContext spiCtx) throws IgniteSpiException Method to be called in the end of onContextInitialized method.- Overrides:
- onContextInitialized0in class- IgniteSpiAdapter
- Parameters:
- spiCtx- SPI context.
- Throws:
- IgniteSpiException- In case of errors.
 
 - 
spiStoppublic void spiStop() throws IgniteSpiExceptionThis method is called to stop SPI. After this method returns kernel assumes that this SPI is finished and all resources acquired by it are released.Note that this method can be called at any point including during recovery of failed start. It should make no assumptions on what state SPI will be in when this method is called. - Specified by:
- spiStopin interface- IgniteSpi
- Throws:
- IgniteSpiException- Thrown in case of any error during SPI stop.
 
 - 
onContextDestroyed0protected void onContextDestroyed0() Method to be called in the beginning of onContextDestroyed() method.- Overrides:
- onContextDestroyed0in class- IgniteSpiAdapter
 
 - 
loadCheckpoint@Nullable public @org.jetbrains.annotations.Nullable byte[] loadCheckpoint(String key) throws IgniteSpiException Loads checkpoint from storage by its unique key.- Specified by:
- loadCheckpointin interface- CheckpointSpi
- 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.
 
 - 
saveCheckpointpublic boolean saveCheckpoint(String key, byte[] state, long timeout, boolean overwrite) throws IgniteSpiException Saves checkpoint to the storage.- Specified by:
- saveCheckpointin interface- CheckpointSpi
- 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.
 
 - 
removeCheckpointpublic boolean removeCheckpoint(String key) This method instructs the checkpoint provider to clean saved data for a givenkey.- Specified by:
- removeCheckpointin interface- CheckpointSpi
- Parameters:
- key- Key for the checkpoint to remove.
- Returns:
- trueif data has been actually removed,- falseotherwise.
 
 - 
setCheckpointListenerpublic void setCheckpointListener(CheckpointListener lsnr) Sets the checkpoint listener.- Specified by:
- setCheckpointListenerin interface- CheckpointSpi
- Parameters:
- lsnr- The listener to set or- null.
 
 - 
setNamepublic CacheCheckpointSpi setName(String name) Sets SPI name.- Overrides:
- setNamein class- IgniteSpiAdapter
- Parameters:
- name- SPI name.
- Returns:
- thisfor chaining.
 
 
- 
 
-