org.ehcache.loaderwriter.writebehind
Class AggregateWriteBehindQueue<K,V>

java.lang.Object
  extended by org.ehcache.loaderwriter.writebehind.AggregateWriteBehindQueue<K,V>
All Implemented Interfaces:
WriteBehind<K,V>

public class AggregateWriteBehindQueue<K,V>
extends java.lang.Object
implements WriteBehind<K,V>


Nested Class Summary
protected static class AggregateWriteBehindQueue.WriteBehindQueueFactory<K,V>
          Factory used to create write behind queues.
 
Constructor Summary
protected AggregateWriteBehindQueue(WriteBehindConfiguration config, AggregateWriteBehindQueue.WriteBehindQueueFactory<K,V> queueFactory, CacheLoaderWriter<K,V> cacheLoaderWriter)
           
  AggregateWriteBehindQueue(WriteBehindConfiguration config, CacheLoaderWriter<K,V> cacheLoaderWriter)
           
 
Method Summary
 void delete(K key)
          Deletes a single entry from the underlying system of record.
 long getQueueSize()
          Gets the best estimate for items in the queue still awaiting processing.
 V load(K key)
          Loads the value to be associated with the given key in the Cache using this CacheLoaderWriter instance.
 void setOperationsFilter(OperationsFilter<SingleOperation<K,V>> filter)
          Set the operations filter that should be used.
 void start()
          Start the write behind queue
 void stop()
          Stop the coordinator and all the internal data structures.
 void write(K key, V value)
          Writes a single entry to the underlying system of record, maybe a brand new value or an update to an existing value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregateWriteBehindQueue

protected AggregateWriteBehindQueue(WriteBehindConfiguration config,
                                    AggregateWriteBehindQueue.WriteBehindQueueFactory<K,V> queueFactory,
                                    CacheLoaderWriter<K,V> cacheLoaderWriter)

AggregateWriteBehindQueue

public AggregateWriteBehindQueue(WriteBehindConfiguration config,
                                 CacheLoaderWriter<K,V> cacheLoaderWriter)
Method Detail

start

public void start()
Description copied from interface: WriteBehind
Start the write behind queue

Specified by:
start in interface WriteBehind<K,V>

load

public V load(K key)
       throws java.lang.Exception
Description copied from interface: WriteBehind
Loads the value to be associated with the given key in the Cache using this CacheLoaderWriter instance.

Specified by:
load in interface WriteBehind<K,V>
Parameters:
key - the key that will map to the value returned
Returns:
the value to be mapped
Throws:
java.lang.Exception

write

public void write(K key,
                  V value)
           throws CacheWritingException
Description copied from interface: WriteBehind
Writes a single entry to the underlying system of record, maybe a brand new value or an update to an existing value

Specified by:
write in interface WriteBehind<K,V>
Throws:
CacheWritingException

delete

public void delete(K key)
            throws CacheWritingException
Description copied from interface: WriteBehind
Deletes a single entry from the underlying system of record.

Specified by:
delete in interface WriteBehind<K,V>
Throws:
CacheWritingException

stop

public void stop()
Description copied from interface: WriteBehind
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<K,V>

setOperationsFilter

public void setOperationsFilter(OperationsFilter<SingleOperation<K,V>> filter)
Description copied from interface: WriteBehind
Set the operations filter that should be used.

Specified by:
setOperationsFilter in interface WriteBehind<K,V>
Parameters:
filter - the filter that will be used as of now

getQueueSize

public long getQueueSize()
Description copied from interface: WriteBehind
Gets the best estimate for items in the queue still awaiting processing. Not including elements currently processed

Specified by:
getQueueSize in interface WriteBehind<K,V>
Returns:
the amount of elements still awaiting processing.