Top Description Fields Constructors Methods
net.sf.ehcache.writer.writebehind

public Class WriteBehindManager

extends Object
implements CacheWriterManager
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.writer.CacheWriterManager
Imports
net.sf.ehcache.Cache, .CacheEntry, .CacheException, .Element, net.sf.ehcache.config.PersistenceConfiguration.Strategy, net.sf.ehcache.store.Store, .TerracottaStore, net.sf.ehcache.writer.CacheWriter, .CacheWriterManager, org.terracotta.statistics.Statistic

Implements a WriterManager that writes elements to a queue first and in the background sends the to the CacheWriter.
Author
Geert Bevin
Version
$Id: WriteBehindManager.java 7936 2013-08-08 20:36:30Z cschanck $

Field Summary

Modifier and TypeField and Description
private final WriteBehind

Constructor Summary

AccessConstructor and Description
public
WriteBehindManager(final Cache
cache
cache
,
final Store store)

Create using the given cache.

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements net.sf.ehcache.writer.CacheWriterManager.dispose.

Cleans up the resources of the cache writer manager.
public long

Returns:

the amount of elements still awaiting processing.
getQueueSize
()

Gets the best estimate for items in the queue still awaiting processing.

public void
init(Cache
the cache with which the writer manager
cache
)

Implements net.sf.ehcache.writer.CacheWriterManager.init.

Initialize the cache writer manager.
public void
put(Element
the element that should be used for the operation
element
)

Implements net.sf.ehcache.writer.CacheWriterManager.put.

Schedule a put operation for this element in the CacheWriterManager, which will call the CacheWriter when appropriate.
public void
remove(CacheEntry
the entry that should be used for the operation
entry
)

Implements net.sf.ehcache.writer.CacheWriterManager.remove.

Schedule a remove operation for this key in the CacheWriterManager, which will call the CacheWriter when appropriate.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

writeBehindback to summary
private final WriteBehind writeBehind

Constructor Detail

WriteBehindManagerback to summary
public WriteBehindManager(final Cache cache, final Store store)

Create using the given cache.

Parameters
cache:Cache

cache

Method Detail

disposeback to summary
public void dispose()

Implements net.sf.ehcache.writer.CacheWriterManager.dispose.

Doc from net.sf.ehcache.writer.CacheWriterManager.dispose.

Cleans up the resources of the cache writer manager.

This method is called when the manager is unregistered from a cache.

getQueueSizeback to summary
public long getQueueSize()

Gets the best estimate for items in the queue still awaiting processing. Not including elements currently processed

Returns:long

the amount of elements still awaiting processing.

Annotations
@Statistic
name:queue-length
tags:write-behind
initback to summary
public void init(Cache cache) throws CacheException

Implements net.sf.ehcache.writer.CacheWriterManager.init.

Doc from net.sf.ehcache.writer.CacheWriterManager.init.

Initialize the cache writer manager.

This method is called when the cache writer manager is registered to a cache.

Parameters
cache:Cache

the cache with which the writer manager

Exceptions
CacheException:
when an exception occurs during the initialisation of the cache
putback to summary
public void put(Element element) throws CacheException

Implements net.sf.ehcache.writer.CacheWriterManager.put.

Doc from net.sf.ehcache.writer.CacheWriterManager.put.

Schedule a put operation for this element in the CacheWriterManager, which will call the CacheWriter when appropriate.

Parameters
element:Element

the element that should be used for the operation

Exceptions
CacheException:
when an exception occurs during the writing of the element
removeback to summary
public void remove(CacheEntry entry) throws CacheException

Implements net.sf.ehcache.writer.CacheWriterManager.remove.

Doc from net.sf.ehcache.writer.CacheWriterManager.remove.

Schedule a remove operation for this key in the CacheWriterManager, which will call the CacheWriter when appropriate.

Parameters
entry:CacheEntry

the entry that should be used for the operation

Exceptions
CacheException:
when an exception occurs during the removal of the element