org.ehcache.impl.internal.loaderwriter.writebehind.operations
Class WriteOperation<K,V>

java.lang.Object
  extended by org.ehcache.impl.internal.loaderwriter.writebehind.operations.WriteOperation<K,V>
All Implemented Interfaces:
KeyBasedOperation<K>, SingleOperation<K,V>

public class WriteOperation<K,V>
extends java.lang.Object
implements SingleOperation<K,V>

Implements the write operation for write behind


Constructor Summary
WriteOperation(K k, V v)
          Create a new write operation for a particular element
WriteOperation(K k, V v, long creationTime)
          Create a new write operation for a particular element and creation time
 
Method Summary
 BatchOperation<K,V> createBatchOperation(java.util.List<? extends SingleOperation<K,V>> operations)
          Creates a batch operation that corresponds to the operation type of this single operation.
 boolean equals(java.lang.Object other)
           
 long getCreationTime()
          Retrieves the moment when the operation was created.
 K getKey()
          Retrieves the element key for this operation.
 V getValue()
           
 int hashCode()
           
 void performSingleOperation(CacheLoaderWriter<K,V> cacheWriter)
          Perform this operation as a single execution with the provided cache writer
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriteOperation

public WriteOperation(K k,
                      V v)
Create a new write operation for a particular element


WriteOperation

public WriteOperation(K k,
                      V v,
                      long creationTime)
Create a new write operation for a particular element and creation time

Method Detail

performSingleOperation

public void performSingleOperation(CacheLoaderWriter<K,V> cacheWriter)
                            throws java.lang.Exception
Description copied from interface: SingleOperation
Perform this operation as a single execution with the provided cache writer

Specified by:
performSingleOperation in interface SingleOperation<K,V>
Throws:
java.lang.Exception

createBatchOperation

public BatchOperation<K,V> createBatchOperation(java.util.List<? extends SingleOperation<K,V>> operations)
Description copied from interface: SingleOperation
Creates a batch operation that corresponds to the operation type of this single operation.

This batch operation will not be stored in the 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 SingleOperation<K,V>

getKey

public K getKey()
Description copied from interface: KeyBasedOperation
Retrieves the element key for this operation.

Specified by:
getKey in interface KeyBasedOperation<K>
Returns:
the key of the element that is concerned by the operation.

getValue

public V getValue()

getCreationTime

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

Specified by:
getCreationTime in interface KeyBasedOperation<K>
Returns:
the creation time in milliseconds

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object