@GridSpiInfo(author="GridGain Systems", url="www.gridgain.com", email="support@gridgain.com", version="6.0.2.${gg.ver.build}") @GridSpiMultipleInstancesSupport(value=true) public class GridS3CheckpointSpi extends GridSpiAdapter implements GridCheckpointSpi, GridS3CheckpointSpiMBean
For information about Amazon S3 visit aws.amazon.com.
GridS3CheckpointSpi can be configured as follows:
GridConfiguration cfg = new GridConfiguration();
GridS3CheckpointSpi spi = new GridS3CheckpointSpi();
AWSCredentials cred = new BasicAWSCredentials(YOUR_ACCESS_KEY_ID, YOUR_SECRET_ACCESS_KEY);
spi.setAwsCredentials(cred);
spi.setBucketNameSuffix("checkpoints");
// Override default checkpoint SPI.
cfg.setCheckpointSpi(cpSpi);
// Start grid.
G.start(cfg);
GridS3CheckpointSpi can be configured from Spring XML configuration file:
<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfiguration" singleton="true">
...
<property name="checkpointSpi">
<bean class="org.gridgain.grid.spi.checkpoint.s3.GridS3CheckpointSpi">
<property name="awsCredentials">
<bean class="com.amazonaws.auth.BasicAWSCredentials">
<constructor-arg value="YOUR_ACCESS_KEY_ID" />
<constructor-arg value="YOUR_SECRET_ACCESS_KEY" />
</bean>
</property>
</bean>
</property>
...
</bean>
Note that storing data in AWS S3 service will result in charges to your AWS account.
Choose another implementation of GridCheckpointSpi for local or
home network tests.
For information about Spring framework visit www.springframework.org
GridCheckpointSpi| Modifier and Type | Field and Description |
|---|---|
static String |
BUCKET_NAME_PREFIX
Prefix to use in bucket name generation.
|
static String |
DFLT_BUCKET_NAME_SUFFIX
Suffix to use in bucket name generation.
|
| Constructor and Description |
|---|
GridS3CheckpointSpi() |
| Modifier and Type | Method and Description |
|---|---|
String |
getAccessKey()
Gets S3 access key.
|
String |
getBucketName()
Gets S3 bucket name to use.
|
String |
getProxyHost()
Gets HTTP proxy host.
|
String |
getProxyPassword()
Gets HTTP proxy password.
|
int |
getProxyPort()
Gets HTTP proxy port.
|
String |
getProxyUsername()
Gets HTTP proxy user name.
|
String |
getSecretAccessKey()
Gets S3 secret key.
|
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 |
setAwsCredentials(com.amazonaws.auth.AWSCredentials cred)
Sets AWS credentials.
|
void |
setBucketNameSuffix(String bucketNameSuffix)
Sets bucket name suffix.
|
void |
setCheckpointListener(GridCheckpointListener lsnr)
Sets the checkpoint listener.
|
void |
setClientConfiguration(com.amazonaws.ClientConfiguration cfg)
Sets Amazon client configuration.
|
void |
spiStart(String gridName)
This method is called to start SPI.
|
void |
spiStop()
This method is called to stop SPI.
|
String |
toString() |
assertParameter, checkConfigurationConsistency0, configInfo, createSpiAttributeName, getAuthor, getConsistentAttributeNames, getGridGainHome, getLocalNodeId, getName, getNodeAttributes, getSpiContext, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion, injectables, onContextDestroyed, onContextDestroyed0, onContextInitialized, onContextInitialized0, registerMBean, setJson, setName, startInfo, startStopwatch, stopInfo, unregisterMBeanclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetName, getNodeAttributes, onContextDestroyed, onContextInitializedsetJsongetAuthor, getGridGainHome, getLocalNodeId, getName, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersionpublic static final String BUCKET_NAME_PREFIX
public static final String DFLT_BUCKET_NAME_SUFFIX
public String getBucketName()
getBucketName in interface GridS3CheckpointSpiMBeanpublic String getAccessKey()
getAccessKey in interface GridS3CheckpointSpiMBeanpublic String getSecretAccessKey()
public String getProxyHost()
getProxyHost in interface GridS3CheckpointSpiMBeanpublic int getProxyPort()
getProxyPort in interface GridS3CheckpointSpiMBeanpublic String getProxyUsername()
getProxyUsername in interface GridS3CheckpointSpiMBeanpublic String getProxyPassword()
@GridSpiConfiguration(optional=true) public void setBucketNameSuffix(String bucketNameSuffix)
bucketNameSuffix - Bucket name suffix.@GridSpiConfiguration(optional=true) public void setClientConfiguration(com.amazonaws.ClientConfiguration cfg)
For details refer to Amazon S3 API reference.
cfg - Amazon client configuration.@GridSpiConfiguration(optional=false) public void setAwsCredentials(com.amazonaws.auth.AWSCredentials cred)
For details refer to Amazon S3 API reference.
cred - AWS credentials.public void spiStart(String gridName) throws GridSpiException
spiStart in interface GridSpigridName - Name of grid instance this SPI is being started for
(null for default grid).GridSpiException - Throws in case of any error during SPI start.public void spiStop()
throws GridSpiException
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.
spiStop in interface GridSpiGridSpiException - Thrown in case of any error during SPI stop.public byte[] loadCheckpoint(String key) throws GridSpiException
loadCheckpoint in interface GridCheckpointSpikey - Checkpoint key.null if there is no data for a given
key.GridSpiException - 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.public boolean saveCheckpoint(String key, byte[] state, long timeout, boolean overwrite) throws GridSpiException
saveCheckpoint in interface GridCheckpointSpikey - 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.GridSpiException - Thrown in case of any error while saving
checkpoint data.public boolean removeCheckpoint(String key)
key.removeCheckpoint in interface GridCheckpointSpikey - Key for the checkpoint to remove.true if data has been actually removed, false
otherwise.public void setCheckpointListener(GridCheckpointListener lsnr)
setCheckpointListener in interface GridCheckpointSpilsnr - The listener to set or null.
Core Products
:
Data Grid ver. 6.0.2,
Streaming ver. 6.0.2
Accelerators
:
Hadoop Accelerator ver. 6.0.2
Release Date
:
March 24 2014