|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.concurrent.locks.ReentrantReadWriteLock net.sf.ehcache.store.disk.Segment
public class Segment
Segment implementation used in LocalStore.
The segment extends ReentrantReadWriteLock to allow read locking on read operations. In addition to the typical CHM-like methods, this classes additionally supports replacement under a read lock - which is accomplished using an atomic CAS on the associated HashEntry.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.concurrent.locks.ReentrantReadWriteLock |
---|
ReentrantReadWriteLock.ReadLock, ReentrantReadWriteLock.WriteLock |
Field Summary | |
---|---|
protected int |
count
Count of elements in the map. |
protected int |
modCount
Mod-count used to track concurrent modifications when doing size calculations or iterating over the store. |
Constructor Summary | |
---|---|
Segment(int initialCapacity,
float loadFactor,
DiskStorageFactory primary,
CacheConfiguration cacheConfiguration,
PoolAccessor onHeapPoolAccessor,
PoolAccessor onDiskPoolAccessor,
RegisteredEventListeners cacheEventNotificationService,
org.terracotta.statistics.observer.OperationObserver<CacheOperationOutcomes.EvictionOutcome> evictionObserver)
Create a Segment with the given initial capacity, load-factor, primary element substitute factory, and identity element substitute factory. |
Method Summary | |
---|---|
boolean |
isFaulted(int hash,
Object key)
Verifies if the mapping for a key is marked as faulted |
String |
toString()
|
Methods inherited from class java.util.concurrent.locks.ReentrantReadWriteLock |
---|
getOwner, getQueuedReaderThreads, getQueuedThreads, getQueuedWriterThreads, getQueueLength, getReadHoldCount, getReadLockCount, getWaitingThreads, getWaitQueueLength, getWriteHoldCount, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isWriteLocked, isWriteLockedByCurrentThread, readLock, writeLock |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected volatile int count
A volatile reference is needed here for the same reasons as in the table reference.
protected int modCount
Note that we don't actually have any iterators yet...
Constructor Detail |
---|
public Segment(int initialCapacity, float loadFactor, DiskStorageFactory primary, CacheConfiguration cacheConfiguration, PoolAccessor onHeapPoolAccessor, PoolAccessor onDiskPoolAccessor, RegisteredEventListeners cacheEventNotificationService, org.terracotta.statistics.observer.OperationObserver<CacheOperationOutcomes.EvictionOutcome> evictionObserver)
An identity element substitute factory is specified at construction time because only one subclass of IdentityElementProxyFactory
can be used with a Segment. Without this requirement the mapping between bare Element
instances and the factory
responsible for them would be ambiguous.
If a null
identity element substitute factory is specified then encountering a raw element (i.e. as a result of using an
identity element substitute factory) will result in a null pointer exception during decode.
initialCapacity
- initial capacity of storeloadFactor
- fraction of capacity at which rehash occursprimary
- primary element substitute factorycacheConfiguration
- the cache configurationonHeapPoolAccessor
- the pool tracking on-heap usageonDiskPoolAccessor
- the pool tracking on-disk usagecacheEventNotificationService
- Method Detail |
---|
public String toString()
toString
in class ReentrantReadWriteLock
public boolean isFaulted(int hash, Object key)
key
- the key to check the mapping for
|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |