ehcache

net.sf.ehcache.writer.writebehind.operations
Class DeleteOperation

java.lang.Object
  extended by net.sf.ehcache.writer.writebehind.operations.DeleteOperation
All Implemented Interfaces:
KeyBasedOperation, SingleOperation

public class DeleteOperation
extends Object
implements SingleOperation

Implements the delete operation for write behind

Version:
$Id: DeleteOperation.java 5793 2012-06-13 23:53:16Z twu $
Author:
Geert Bevin

Constructor Summary
DeleteOperation(CacheEntry entry)
          Create a new delete operation for a particular entry
DeleteOperation(CacheEntry entry, long creationTime)
          Create a new delete operation for a particular entry and creation time
 
Method Summary
 BatchOperation createBatchOperation(List<SingleOperation> operations)
          Creates a batch operation that corresponds to the operation type of this single operation.
 boolean equals(Object other)
          
 long getCreationTime()
          Retrieves the moment when the operation was created.
 CacheEntry getEntry()
          Retrieves the entry that will be used for this operation
 Object getKey()
          Retrieves the element key for this operation.
 SingleOperationType getType()
          Returns a stable identifier for the type this operation can be classified in.
 int hashCode()
          
 void performSingleOperation(CacheWriter cacheWriter)
          Perform this operation as a single execution with the provided cache writer
 void throwAway(CacheWriter cacheWriter, RuntimeException e)
          Called when all retries have failed
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeleteOperation

public DeleteOperation(CacheEntry entry)
Create a new delete operation for a particular entry

Parameters:
entry - the entry to delete

DeleteOperation

public DeleteOperation(CacheEntry entry,
                       long creationTime)
Create a new delete operation for a particular entry and creation time

Parameters:
entry - the entry to delete
creationTime - the creation time of the operation
Method Detail

performSingleOperation

public void performSingleOperation(CacheWriter cacheWriter)
Perform this operation as a single execution with the provided cache writer

Specified by:
performSingleOperation in interface SingleOperation
Parameters:
cacheWriter - the cache writer this operation should be performed upon

createBatchOperation

public BatchOperation createBatchOperation(List<SingleOperation> operations)
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
Parameters:
operations - the single operations that need to be regrouped in the batch operation
Returns:
the created batch operation

getKey

public Object getKey()
Retrieves the element key for this operation.

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

getCreationTime

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

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

getEntry

public CacheEntry getEntry()
Retrieves the entry that will be used for this operation


getType

public SingleOperationType getType()
Returns a stable identifier for the type this operation can be classified in. This is used to group and order batched operations.

Specified by:
getType in interface SingleOperation
Returns:
the identifier for this operation type

throwAway

public void throwAway(CacheWriter cacheWriter,
                      RuntimeException e)
Called when all retries have failed

Specified by:
throwAway in interface SingleOperation
Parameters:
cacheWriter - the CacheWriter to delegate to
e - the last exception encountered

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object other)

Overrides:
equals in class Object

ehcache

Copyright 2001-2015, Terracotta, Inc.