GigaSpaces XAP 9.7.2 API

org.openspaces.persistency.cassandra.archive
Class CassandraArchiveOperationHandler

java.lang.Object
  extended by org.openspaces.persistency.cassandra.archive.CassandraArchiveOperationHandler
All Implemented Interfaces:
ArchiveOperationHandler

public class CassandraArchiveOperationHandler
extends Object
implements ArchiveOperationHandler

Known Limitation: 1. The archiver must not write two different entries with the same ID. This would corrupt the entry in Cassandra. 2. Only Space Documents are supported 3. The archiver is thread safe 4. The archiver is idempotent as long as there are no two threads that are writing two different objects with the same space id.

Since:
9.1.1
Author:
Dan Kilman

Constructor Summary
CassandraArchiveOperationHandler()
           
 
Method Summary
 void afterPropertiesSet()
           
 void archive(Object... objects)
          Writes the specified objects to the external storage
 void destroy()
           
 ColumnFamilyNameConverter getColumnFamilyNameConverter()
           
 FlattenedPropertiesFilter getFlattenedPropertiesFilter()
           
 GigaSpace getGigaSpace()
           
 String getHosts()
           
 String getKeyspace()
           
 Integer getPort()
           
 PropertyValueSerializer getPropertyValueSerializer()
           
 CassandraConsistencyLevel getWriteConsistency()
           
 void setColumnFamilyNameConverter(ColumnFamilyNameConverter columnFamilyNameConverter)
           
 void setFlattenedPropertiesFilter(FlattenedPropertiesFilter flattenedPropertiesFilter)
           
 void setGigaSpace(GigaSpace gigaSpace)
           
 void setHosts(String hosts)
           
 void setKeyspace(String keyspace)
           
 void setPort(Integer port)
           
 void setPropertyValueSerializer(PropertyValueSerializer propertyValueSerializer)
           
 void setWriteConsistency(CassandraConsistencyLevel writeConsistency)
           
 boolean supportsBatchArchiving()
          What happens when the archive operation receives a batch of objects to persist and throws an exception in the middle of the archiving?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CassandraArchiveOperationHandler

public CassandraArchiveOperationHandler()
Method Detail

setGigaSpace

public void setGigaSpace(GigaSpace gigaSpace)

setHosts

public void setHosts(String hosts)
Parameters:
hosts - - Comma separated list of Cassandra servers (ipaddresses or hostnames).
See Also:
HectorCassandraClientConfigurer.hosts(String)

setPort

public void setPort(Integer port)
Parameters:
port - - Cassandra server ports. Assumes same port for all servers. null means default port is used.
See Also:
HectorCassandraClientConfigurer.port(Integer)

setKeyspace

public void setKeyspace(String keyspace)
Parameters:
keyspace - - the Cassandra keyspace name to connect to.
See Also:
HectorCassandraClientConfigurer.keyspaceName(String)

setWriteConsistency

public void setWriteConsistency(CassandraConsistencyLevel writeConsistency)
Parameters:
writeConsistency - - defines the consistency level used when writing to Cassandra. default is null (which is mapped to CassandraConsistencyLevel.QUORUM )
See Also:
HectorCassandraClientConfigurer.writeConsistencyLevel(CassandraConsistencyLevel)

setPropertyValueSerializer

public void setPropertyValueSerializer(PropertyValueSerializer propertyValueSerializer)
See Also:
PropertyValueSerializer

setFlattenedPropertiesFilter

public void setFlattenedPropertiesFilter(FlattenedPropertiesFilter flattenedPropertiesFilter)
See Also:
FlattenedPropertiesFilter

setColumnFamilyNameConverter

public void setColumnFamilyNameConverter(ColumnFamilyNameConverter columnFamilyNameConverter)
See Also:
ColumnFamilyNameConverter

getGigaSpace

public GigaSpace getGigaSpace()

getPropertyValueSerializer

public PropertyValueSerializer getPropertyValueSerializer()

getFlattenedPropertiesFilter

public FlattenedPropertiesFilter getFlattenedPropertiesFilter()

getColumnFamilyNameConverter

public ColumnFamilyNameConverter getColumnFamilyNameConverter()

getHosts

public String getHosts()

getPort

public Integer getPort()

getKeyspace

public String getKeyspace()

getWriteConsistency

public CassandraConsistencyLevel getWriteConsistency()

afterPropertiesSet

@PostConstruct
public void afterPropertiesSet()

destroy

@PreDestroy
public void destroy()

archive

public void archive(Object... objects)
Description copied from interface: ArchiveOperationHandler
Writes the specified objects to the external storage

Specified by:
archive in interface ArchiveOperationHandler
Parameters:
objects - - one or more objects to write. If not ArchiveOperationHandler.supportsBatchArchiving() then only one object is passed at a time.
Throws:
SpaceCassandraException - - Problem encountered while archiving to cassandra
See Also:
ArchiveOperationHandler.archive(Object...)

supportsBatchArchiving

public boolean supportsBatchArchiving()
Description copied from interface: ArchiveOperationHandler
What happens when the archive operation receives a batch of objects to persist and throws an exception in the middle of the archiving? The external archive container (assuming the exception is not swollen with an exception handler) will retry archiving all objects. If the archive operation implementation is atomic (meaning that throwing an exception cancels all writes - all or nothing) then return true. If the archive operation implementation is idempotent (meaning that writing the same objects twice has no visibility on the result) then return true. Otherwise return false, so the archive method is called one object at a time. Even when returning false, there is a possibility of an object being archived twice in case of a process fail-over.

Specified by:
supportsBatchArchiving in interface ArchiveOperationHandler
Returns:
true - Since Multiple archiving of the exact same objects is supported (idempotent).
See Also:
ArchiveOperationHandler.supportsBatchArchiving()

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.