org.terracotta.modules.ehcache.writebehind.operations
Interface SingleAsyncOperation

All Known Implementing Classes:
DeleteAsyncOperation, WriteAsyncOperation

public interface SingleAsyncOperation

Interface to implement single operations that are performed in the write behind implementation that using an AsyncCoordinator underneath

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

Method Summary
 BatchAsyncOperation createBatchOperation(List<SingleAsyncOperation> operations, SerializationStrategy serializationStrategy)
          Creates a batch operation that corresponds to the operation type of this single async operation.
 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
 

Method Detail

performSingleOperation

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

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

createBatchOperation

BatchAsyncOperation createBatchOperation(List<SingleAsyncOperation> operations,
                                         SerializationStrategy serializationStrategy)
                                         throws ClassNotFoundException,
                                                IOException
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.

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

Object getKey(SerializationStrategy serializationStrategy)
              throws IOException,
                     ClassNotFoundException
Retrieves the key for this operation.

Parameters:
serializationStrategy - the serialization strategy that should be used to create the key
Returns:
this operation's key
Throws:
IOException
ClassNotFoundException

getCreationTime

long getCreationTime()
Retrieves the moment when the operation was created.

Returns:
the creation time in milliseconds


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