ehcache

net.sf.ehcache.writer.writebehind
Class WriteBehindQueue

java.lang.Object
  extended by net.sf.ehcache.writer.writebehind.WriteBehindQueue
All Implemented Interfaces:
WriteBehind

public class WriteBehindQueue
extends java.lang.Object
implements WriteBehind

An implementation of write behind with a queue that is kept in non durable local heap.

Version:
$Id: WriteBehindQueue.java 1924 2010-02-23 21:11:05Z gbevin $
Author:
Geert Bevin

Constructor Summary
WriteBehindQueue(CacheConfiguration config)
          Create a new write behind queue.
 
Method Summary
 void delete(CacheEntry entry)
          Add a delete operation for the given cache entry
 void setOperationsFilter(OperationsFilter filter)
          Set the operations filter that should be used.
 void start(CacheWriter writer)
          Start the write behind queue with a cache writer
 void stop()
          Stop the coordinator and all the internal data structures.
 void write(Element element)
          Add a write operation for a given element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriteBehindQueue

public WriteBehindQueue(CacheConfiguration config)
Create a new write behind queue.

Parameters:
config - the configuration for the queue
Method Detail

start

public void start(CacheWriter writer)
Start the write behind queue with a cache writer

Specified by:
start in interface WriteBehind
Parameters:
writer - the cache writer that should be used to process the operations
See Also:
WriteBehind.stop()

setOperationsFilter

public void setOperationsFilter(OperationsFilter filter)
Set the operations filter that should be used.

Specified by:
setOperationsFilter in interface WriteBehind
Parameters:
filter - the filter that will be used as of now

write

public void write(Element element)
Add a write operation for a given element.

Specified by:
write in interface WriteBehind
Parameters:
element - the element for which a write operation will be added to the write behind queue

delete

public void delete(CacheEntry entry)
Add a delete operation for the given cache entry

Specified by:
delete in interface WriteBehind
Parameters:
entry - the cache entry for which a delete operation will be added to the write behind queue

stop

public void stop()
Stop the coordinator and all the internal data structures.

This stops as quickly as possible without losing any previously added items. However, no guarantees are made towards the processing of these items. It's highly likely that items are still inside the internal data structures and not processed.

Specified by:
stop in interface WriteBehind
See Also:
WriteBehind.start(net.sf.ehcache.writer.CacheWriter)

ehcache

true