org.terracotta.modules.ehcache.writebehind.operations
Class WriteAsyncOperation

java.lang.Object
  extended by org.terracotta.modules.ehcache.writebehind.operations.WriteAsyncOperation
All Implemented Interfaces:
SingleAsyncOperation

public class WriteAsyncOperation
extends Object
implements SingleAsyncOperation

Implements the write operation for write behind

Version:
$Id: WriteAsyncOperation.java 23027 2010-05-21 14:24:50Z hhuynh $
Author:
Geert Bevin

Constructor Summary
WriteAsyncOperation(ElementSnapshot snapshot)
           
 
Method Summary
 BatchAsyncOperation createBatchOperation(List<SingleAsyncOperation> operations, SerializationStrategy serializationStrategy)
          Creates a batch operation that corresponds to the operation type of this single async operation.
 net.sf.ehcache.Element createElement(SerializationStrategy serializationStrategy)
           
 long getCreationTime()
          Retrieves the moment when the operation was created.
 Object getKey(SerializationStrategy serializationStrategy)
          Retrieves the key for this operation.
 void performSingleOperation(net.sf.ehcache.writer.CacheWriter cacheWriter, SerializationStrategy serializationStrategy)
          Perform this operation as a single execution with the provided cache writer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriteAsyncOperation

public WriteAsyncOperation(ElementSnapshot snapshot)
Method Detail

performSingleOperation

public void performSingleOperation(net.sf.ehcache.writer.CacheWriter cacheWriter,
                                   SerializationStrategy serializationStrategy)
                            throws ClassNotFoundException,
                                   IOException
Description copied from interface: SingleAsyncOperation
Perform this operation as a single execution with the provided cache writer

Specified by:
performSingleOperation in interface SingleAsyncOperation
Parameters:
cacheWriter - the cache writer this operation should be performed upon
serializationStrategy - the strategy that should be used to serialize and deserialize, if needed
Throws:
ClassNotFoundException
IOException

createElement

public net.sf.ehcache.Element createElement(SerializationStrategy serializationStrategy)
                                     throws ClassNotFoundException,
                                            IOException
Throws:
ClassNotFoundException
IOException

createBatchOperation

public BatchAsyncOperation createBatchOperation(List<SingleAsyncOperation> operations,
                                                SerializationStrategy serializationStrategy)
                                         throws ClassNotFoundException,
                                                IOException
Description copied from interface: SingleAsyncOperation
Creates a batch operation that corresponds to the operation type of this single async operation.

This batch operation will not be stored in the async queue anymore and is solely used for structuring. The data from the single operation will already be processed in the final form that will be expected by the CacheWriter that will be used to execute the batch operation.

Specified by:
createBatchOperation in interface SingleAsyncOperation
Parameters:
operations - the single operations that need to be regrouped in the batch operation
serializationStrategy - the serialization strategy that should be used to create the data for the batch operation
Returns:
the created batch operation
Throws:
ClassNotFoundException
IOException

getKey

public Object getKey(SerializationStrategy serializationStrategy)
              throws IOException,
                     ClassNotFoundException
Description copied from interface: SingleAsyncOperation
Retrieves the key for this operation.

Specified by:
getKey in interface SingleAsyncOperation
Parameters:
serializationStrategy - the serialization strategy that should be used to create the key
Returns:
this operation's key
Throws:
IOException
ClassNotFoundException

getCreationTime

public long getCreationTime()
Description copied from interface: SingleAsyncOperation
Retrieves the moment when the operation was created.

Specified by:
getCreationTime in interface SingleAsyncOperation
Returns:
the creation time in milliseconds


Copyright © 2010 Terracotta, Inc.. All Rights Reserved.