Package org.apache.hadoop.hbase.quotas
Class RegionSizeStoreImpl
java.lang.Object
org.apache.hadoop.hbase.quotas.RegionSizeStoreImpl
- All Implemented Interfaces:
Iterable<Map.Entry<RegionInfo,
,RegionSize>> HeapSize
,RegionSizeStore
A
RegionSizeStore
implementation backed by a ConcurrentHashMap. We expected similar
amounts of reads and writes to the "store", so using a RWLock is not going to provide any
exceptional gains.-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
private static final long
private final ConcurrentHashMap<RegionInfo,
RegionSize> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all entries from the store.getRegionSize
(RegionInfo regionInfo) Returns the size for the give region if one exists.long
heapSize()
Return the approximate 'exclusive deep size' of implementing object.void
incrementRegionSize
(RegionInfo regionInfo, long delta) Atomically alter the size of a region.boolean
isEmpty()
Returns if the store is empty.iterator()
void
put
(RegionInfo regionInfo, long size) Atomically sets the givensize
for a region.remove
(RegionInfo regionInfo) Removes the mapping for the given key, returning the value if one exists in the store.int
size()
Returns the number of entries in the store.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
LOG
-
sizeOfEntry
-
store
-
-
Constructor Details
-
RegionSizeStoreImpl
public RegionSizeStoreImpl()
-
-
Method Details
-
iterator
- Specified by:
iterator
in interfaceIterable<Map.Entry<RegionInfo,
RegionSize>>
-
getRegionSize
Description copied from interface:RegionSizeStore
Returns the size for the give region if one exists. If no size exists,null
is returned.- Specified by:
getRegionSize
in interfaceRegionSizeStore
- Parameters:
regionInfo
- The region whose size is being fetched.- Returns:
- The size in bytes of the region or null if no size is stored.
-
put
Description copied from interface:RegionSizeStore
Atomically sets the givensize
for a region.- Specified by:
put
in interfaceRegionSizeStore
- Parameters:
regionInfo
- An identifier for a region.size
- The size in bytes of the region.
-
incrementRegionSize
Description copied from interface:RegionSizeStore
Atomically alter the size of a region.- Specified by:
incrementRegionSize
in interfaceRegionSizeStore
- Parameters:
regionInfo
- The region to update.delta
- The change in size for the region, positive or negative.
-
remove
Description copied from interface:RegionSizeStore
Removes the mapping for the given key, returning the value if one exists in the store.- Specified by:
remove
in interfaceRegionSizeStore
- Parameters:
regionInfo
- The key to remove from the store- Returns:
- The value removed from the store if one exists, otherwise null.
-
heapSize
Description copied from interface:HeapSize
Return the approximate 'exclusive deep size' of implementing object. Includes count of payload and hosting object sizings. -
size
Description copied from interface:RegionSizeStore
Returns the number of entries in the store.- Specified by:
size
in interfaceRegionSizeStore
- Returns:
- The number of entries in the store.
-
isEmpty
Description copied from interface:RegionSizeStore
Returns if the store is empty.- Specified by:
isEmpty
in interfaceRegionSizeStore
- Returns:
- true if there are no entries in the store, otherwise false.
-
clear
Description copied from interface:RegionSizeStore
Removes all entries from the store.- Specified by:
clear
in interfaceRegionSizeStore
-