All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.terracotta.modules.ehcache.writebehind.operations.SingleAsyncOperation Maven / Gradle / Ivy

Go to download

Ehcache is an open source, standards-based cache used to boost performance, offload the database and simplify scalability. Ehcache is robust, proven and full-featured and this has made it the most widely-used Java-based cache.

There is a newer version: 2.10.9.2
Show newest version
/*
 * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
 */
package org.terracotta.modules.ehcache.writebehind.operations;

import net.sf.ehcache.Element;
import net.sf.ehcache.writer.CacheWriter;

import java.io.IOException;
import java.io.Serializable;

/**
 * Interface to implement single operations that are performed in the write behind implementation that using an
 * AsyncCoordinator underneath
 * 
 * @author Abhishek Maheshwari
 */
public interface SingleAsyncOperation extends Serializable {
  /**
   * Perform this operation as a single execution with the provided cache writer
   * 
   * @param cacheWriter the cache writer this operation should be performed upon
   * @param serializationStrategy the strategy that should be used to serialize and deserialize, if needed
   */
  public void performSingleOperation(CacheWriter cacheWriter) throws ClassNotFoundException, IOException;

  /**
   * Retrieves the key for this operation.
   * 
   * @param serializationStrategy the serialization strategy that should be used to create the key
   * @return this operation's key
   */
  Object getKey();

  Element getElement();

  /**
   * Retrieves the moment when the operation was created.
   * 
   * @return the creation time in milliseconds
   */
  public long getCreationTime();

  /**
   * This method will be called to throw the item away.
   * 
   * @param cacheWriter
   * @param serializationStrategy
   * @param e
   * @throws ClassNotFoundException
   * @throws IOException
   */
  void throwAwayElement(CacheWriter cacheWriter, RuntimeException e);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy