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

public Class WriteBehindQueueManager

extends Object
implements WriteBehind
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.writer.writebehind.WriteBehind
Imports
java.util.ArrayList, .List, java.util.concurrent.locks.ReentrantReadWriteLock, net.sf.ehcache.CacheEntry, .CacheException, .Element, net.sf.ehcache.config.CacheConfiguration, .CacheWriterConfiguration, net.sf.ehcache.writer.CacheWriter

Author
Alex Snaps

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
WriteBehindQueueManager.WriteBehindQueueFactory

Factory used to create write behind queues.

Field Summary

Modifier and TypeField and Description
private final List<WriteBehind>
private final ReentrantReadWriteLock.ReadLock
private final ReentrantReadWriteLock
private final ReentrantReadWriteLock.WriteLock

Constructor Summary

AccessConstructor and Description
protected
WriteBehindQueueManager(CacheConfiguration
configuration for the cache this write behind queue manager is working with
config
,
WriteBehindQueueManager.WriteBehindQueueFactory
factory used to create the write behind queues.
queueFactory
)

Create the write behind queue manager with queues created via the passed in WriteBehindQueueFactory

public
WriteBehindQueueManager(CacheConfiguration
the configuration for the queue
config
)

Create a new write behind queue manager.

Method Summary

Modifier and TypeMethod and Description
public void
delete(final CacheEntry
the cache entry for which a delete operation will be added to the write behind queue
entry
)

Implements net.sf.ehcache.writer.writebehind.WriteBehind.delete.

Add a delete operation for the given cache entry
private WriteBehind
getQueue(final Object key)

public long
getQueueSize()

Implements net.sf.ehcache.writer.writebehind.WriteBehind.getQueueSize.

Gets the best estimate for items in the queue still awaiting processing.
public void
setOperationsFilter(final OperationsFilter<T>
the filter that will be used as of now
filter
)

Implements net.sf.ehcache.writer.writebehind.WriteBehind.setOperationsFilter.

Set the operations filter that should be used.
public void
start(final CacheWriter
the cache writer that should be used to process the operations
writer
)

Implements net.sf.ehcache.writer.writebehind.WriteBehind.start.

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

Implements net.sf.ehcache.writer.writebehind.WriteBehind.stop.

Stop the coordinator and all the internal data structures.
public void
write(final Element
the element for which a write operation will be added to the write behind queue
element
)

Implements net.sf.ehcache.writer.writebehind.WriteBehind.write.

Add a write operation for a given element.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

queuesback to summary
private final List<WriteBehind> queues
readLockback to summary
private final ReentrantReadWriteLock.ReadLock readLock
rwLockback to summary
private final ReentrantReadWriteLock rwLock
writeLockback to summary
private final ReentrantReadWriteLock.WriteLock writeLock

Constructor Detail

WriteBehindQueueManagerback to summary
protected WriteBehindQueueManager(CacheConfiguration config, WriteBehindQueueManager.WriteBehindQueueFactory queueFactory)

Create the write behind queue manager with queues created via the passed in WriteBehindQueueFactory

Parameters
config:CacheConfiguration

configuration for the cache this write behind queue manager is working with

queueFactory:WriteBehindQueueManager.WriteBehindQueueFactory

factory used to create the write behind queues.

WriteBehindQueueManagerback to summary
public WriteBehindQueueManager(CacheConfiguration config)

Create a new write behind queue manager. Which in turn will create as many queues as required by the net.sf.ehcache.config.CacheWriterConfiguration#getWriteBehindConcurrency

Parameters
config:CacheConfiguration

the configuration for the queue

Method Detail

deleteback to summary
public void delete(final CacheEntry entry)

Implements net.sf.ehcache.writer.writebehind.WriteBehind.delete.

Doc from net.sf.ehcache.writer.writebehind.WriteBehind.delete.

Add a delete operation for the given cache entry

Parameters
entry:CacheEntry

the cache entry for which a delete operation will be added to the write behind queue

getQueueback to summary
private WriteBehind getQueue(final Object key)
getQueueSizeback to summary
public long getQueueSize()

Implements net.sf.ehcache.writer.writebehind.WriteBehind.getQueueSize.

Doc from net.sf.ehcache.writer.writebehind.WriteBehind.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.

setOperationsFilterback to summary
public void setOperationsFilter(final OperationsFilter<T> filter)

Implements net.sf.ehcache.writer.writebehind.WriteBehind.setOperationsFilter.

Doc from net.sf.ehcache.writer.writebehind.WriteBehind.setOperationsFilter.

Set the operations filter that should be used.

Parameters
filter:OperationsFilter<T>

the filter that will be used as of now

startback to summary
public void start(final CacheWriter writer) throws CacheException

Implements net.sf.ehcache.writer.writebehind.WriteBehind.start.

Doc from net.sf.ehcache.writer.writebehind.WriteBehind.start.

Start the write behind queue with a cache writer

Parameters
writer:CacheWriter

the cache writer that should be used to process the operations

stopback to summary
public void stop() throws CacheException

Implements net.sf.ehcache.writer.writebehind.WriteBehind.stop.

Doc from net.sf.ehcache.writer.writebehind.WriteBehind.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.

writeback to summary
public void write(final Element element)

Implements net.sf.ehcache.writer.writebehind.WriteBehind.write.

Doc from net.sf.ehcache.writer.writebehind.WriteBehind.write.

Add a write operation for a given element.

Parameters
element:Element

the element for which a write operation will be added to the write behind queue

net.sf.ehcache.writer.writebehind back to summary

protected Class WriteBehindQueueManager.WriteBehindQueueFactory

extends Object
Class Inheritance
  • java.lang.Object
  • net.sf.ehcache.writer.writebehind.WriteBehindQueueManager.WriteBehindQueueFactory

Factory used to create write behind queues.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected WriteBehind

Returns:

a write behind queue
createQueue
(int
index of the stripe
index
,
CacheConfiguration
cache configuration for the cache this queue will be associated with.
config
)

Create a write behind queue stripe.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

WriteBehindQueueFactoryback to summary
protected WriteBehindQueueFactory()

Method Detail

createQueueback to summary
protected WriteBehind createQueue(int index, CacheConfiguration config)

Create a write behind queue stripe.

Parameters
index:int

index of the stripe

config:CacheConfiguration

cache configuration for the cache this queue will be associated with.

Returns:WriteBehind

a write behind queue