public abstract class OffheapMap<K,V> extends Object implements OffheapMapMXBean
| Modifier and Type | Class and Description |
|---|---|
class |
OffheapMap.BasicCleanup |
static class |
OffheapMap.Record<K,V> |
class |
OffheapMap.SamplingCleanup |
static interface |
OffheapMap.Visitor<K,V> |
static class |
OffheapMap.WritableRecord<K,V> |
static interface |
OffheapMap.WritableVisitor<K,V> |
| Modifier and Type | Field and Description |
|---|---|
protected static long |
byteArrayOffset |
protected int |
capacity |
protected long |
cleanupInterval |
protected OffheapMap.BasicCleanup |
cleanupThread |
protected double |
cleanupThreshold |
protected static int |
CONCURRENCY_LEVEL |
protected AtomicInteger |
count |
protected AtomicLong |
expirations |
protected static int |
HASH_OFFSET |
protected static int |
HEADER_SIZE |
protected RWLock[] |
locks |
protected long |
lockWaitTime |
protected static org.apache.commons.logging.Log |
log |
protected long |
mapBase |
protected int |
maxSamples |
protected static long |
MB |
protected long |
minTimeToLive |
protected static int |
NEXT_OFFSET |
protected static int |
TIME_OFFSET |
protected long |
timeToLive |
protected static sun.misc.Unsafe |
unsafe |
| Modifier | Constructor and Description |
|---|---|
protected |
OffheapMap(int capacity) |
protected |
OffheapMap(int capacity,
long address) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract long |
allocateEntry(K key,
long hashCode,
int size) |
protected long |
bucketFor(long hashCode) |
void |
clear() |
void |
close() |
protected void |
closeInternal() |
protected abstract void |
destroyEntry(long entry) |
int |
entriesToClean() |
protected abstract boolean |
equalsAt(long entry,
K key) |
V |
get(K key) |
int |
getCapacity() |
long |
getCleanupInterval() |
double |
getCleanupThreshold() |
int |
getCount() |
long |
getExpirations() |
long |
getLockWaitTime() |
int |
getMaxSamples() |
long |
getMinTimeToLive() |
long |
getTimeToLive() |
protected abstract long |
hashCode(K key) |
protected boolean |
isExpired(long entry,
boolean touch) |
void |
iterate(OffheapMap.Visitor<K,V> visitor) |
void |
iterate(OffheapMap.Visitor<K,V> visitor,
int workers) |
void |
iterate(OffheapMap.Visitor<K,V> visitor,
int taskNum,
int taskCount) |
void |
iterate(OffheapMap.WritableVisitor<K,V> visitor) |
void |
iterate(OffheapMap.WritableVisitor<K,V> visitor,
int workers) |
void |
iterate(OffheapMap.WritableVisitor<K,V> visitor,
int taskNum,
int taskCount) |
protected K |
keyAt(long entry) |
protected RWLock |
lockFor(long hashCode) |
OffheapMap.Record<K,V> |
lockRecordForRead(K key) |
OffheapMap.Record<K,V> |
lockRecordForRead(K key,
long timeout) |
OffheapMap.WritableRecord<K,V> |
lockRecordForWrite(K key,
boolean create) |
OffheapMap.WritableRecord<K,V> |
lockRecordForWrite(K key,
long timeout,
boolean create) |
boolean |
put(K key,
V value) |
boolean |
putIfAbsent(K key,
V value) |
boolean |
remove(K key) |
int |
removeExpired(long expirationAge) |
void |
setCleanupInterval(long cleanupInterval) |
void |
setCleanupThreshold(double cleanupThreshold) |
void |
setLockWaitTime(long lockWaitTime) |
void |
setMaxSamples(int maxSamples) |
void |
setMinTimeToLive(long minTimeToLive) |
protected void |
setTimeAt(long entry) |
protected void |
setTimeAt(long entry,
long time) |
void |
setTimeToLive(long timeToLive) |
protected abstract void |
setValueAt(long entry,
V value) |
protected boolean |
shouldCleanup(long entry,
long expirationTime) |
protected abstract int |
sizeOf(long entry) |
protected abstract int |
sizeOf(V value) |
protected long |
timeAt(long entry) |
void |
touch(K key) |
protected abstract V |
valueAt(long entry) |
protected static final org.apache.commons.logging.Log log
protected static final sun.misc.Unsafe unsafe
protected static final long byteArrayOffset
protected static final long MB
protected static final int CONCURRENCY_LEVEL
protected static final int HASH_OFFSET
protected static final int NEXT_OFFSET
protected static final int TIME_OFFSET
protected static final int HEADER_SIZE
protected final int capacity
protected final AtomicInteger count
protected final AtomicLong expirations
protected final RWLock[] locks
protected long mapBase
protected long timeToLive
protected long minTimeToLive
protected long lockWaitTime
protected long cleanupInterval
protected double cleanupThreshold
protected int maxSamples
protected OffheapMap.BasicCleanup cleanupThread
protected OffheapMap(int capacity)
protected OffheapMap(int capacity,
long address)
public final void close()
protected void closeInternal()
public long getTimeToLive()
getTimeToLive in interface OffheapMapMXBeanpublic void setTimeToLive(long timeToLive)
setTimeToLive in interface OffheapMapMXBeanpublic long getMinTimeToLive()
getMinTimeToLive in interface OffheapMapMXBeanpublic void setMinTimeToLive(long minTimeToLive)
setMinTimeToLive in interface OffheapMapMXBeanpublic long getLockWaitTime()
getLockWaitTime in interface OffheapMapMXBeanpublic void setLockWaitTime(long lockWaitTime)
setLockWaitTime in interface OffheapMapMXBeanpublic long getCleanupInterval()
getCleanupInterval in interface OffheapMapMXBeanpublic void setCleanupInterval(long cleanupInterval)
setCleanupInterval in interface OffheapMapMXBeanpublic double getCleanupThreshold()
getCleanupThreshold in interface OffheapMapMXBeanpublic void setCleanupThreshold(double cleanupThreshold)
setCleanupThreshold in interface OffheapMapMXBeanpublic int getMaxSamples()
getMaxSamples in interface OffheapMapMXBeanpublic void setMaxSamples(int maxSamples)
setMaxSamples in interface OffheapMapMXBeanpublic int getCapacity()
getCapacity in interface OffheapMapMXBeanpublic int getCount()
getCount in interface OffheapMapMXBeanpublic long getExpirations()
getExpirations in interface OffheapMapMXBeanpublic boolean put(K key, V value) throws OutOfMemoryException
OutOfMemoryExceptionpublic boolean putIfAbsent(K key, V value) throws OutOfMemoryException
OutOfMemoryExceptionpublic boolean remove(K key)
public void touch(K key)
public OffheapMap.Record<K,V> lockRecordForRead(K key, long timeout) throws TimeoutException
TimeoutExceptionpublic OffheapMap.Record<K,V> lockRecordForRead(K key)
public OffheapMap.WritableRecord<K,V> lockRecordForWrite(K key, long timeout, boolean create) throws TimeoutException
TimeoutExceptionpublic OffheapMap.WritableRecord<K,V> lockRecordForWrite(K key, boolean create)
public int entriesToClean()
public int removeExpired(long expirationAge)
public void clear()
public void iterate(OffheapMap.Visitor<K,V> visitor)
public void iterate(OffheapMap.Visitor<K,V> visitor, int workers)
public void iterate(OffheapMap.Visitor<K,V> visitor, int taskNum, int taskCount)
public void iterate(OffheapMap.WritableVisitor<K,V> visitor)
public void iterate(OffheapMap.WritableVisitor<K,V> visitor, int workers)
public void iterate(OffheapMap.WritableVisitor<K,V> visitor, int taskNum, int taskCount)
protected long bucketFor(long hashCode)
protected RWLock lockFor(long hashCode)
protected long timeAt(long entry)
protected void setTimeAt(long entry)
protected void setTimeAt(long entry,
long time)
protected boolean isExpired(long entry,
boolean touch)
protected boolean shouldCleanup(long entry,
long expirationTime)
protected K keyAt(long entry)
protected abstract long hashCode(K key)
protected abstract boolean equalsAt(long entry,
K key)
protected abstract V valueAt(long entry)
protected abstract void setValueAt(long entry,
V value)
protected abstract long allocateEntry(K key, long hashCode, int size) throws OutOfMemoryException
OutOfMemoryExceptionprotected abstract void destroyEntry(long entry)
protected abstract int sizeOf(long entry)
protected abstract int sizeOf(V value)
Copyright © 2019. All rights reserved.