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
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate static final longprivate final ConcurrentHashMap<RegionInfo,RegionSize> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all entries from the store.getRegionSize(RegionInfo regionInfo) Returns the size for the give region if one exists.longheapSize()Return the approximate 'exclusive deep size' of implementing object.voidincrementRegionSize(RegionInfo regionInfo, long delta) Atomically alter the size of a region.booleanisEmpty()Returns if the store is empty.iterator()voidput(RegionInfo regionInfo, long size) Atomically sets the givensizefor a region.remove(RegionInfo regionInfo) Removes the mapping for the given key, returning the value if one exists in the store.intsize()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, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
LOG
-
sizeOfEntry
-
store
-
-
Constructor Details
-
RegionSizeStoreImpl
public RegionSizeStoreImpl()
-
-
Method Details
-
iterator
- Specified by:
iteratorin interfaceIterable<Map.Entry<RegionInfo,RegionSize>>
-
getRegionSize
Description copied from interface:RegionSizeStoreReturns the size for the give region if one exists. If no size exists,nullis returned.- Specified by:
getRegionSizein 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:RegionSizeStoreAtomically sets the givensizefor a region.- Specified by:
putin interfaceRegionSizeStore- Parameters:
regionInfo- An identifier for a region.size- The size in bytes of the region.
-
incrementRegionSize
Description copied from interface:RegionSizeStoreAtomically alter the size of a region.- Specified by:
incrementRegionSizein interfaceRegionSizeStore- Parameters:
regionInfo- The region to update.delta- The change in size for the region, positive or negative.
-
remove
Description copied from interface:RegionSizeStoreRemoves the mapping for the given key, returning the value if one exists in the store.- Specified by:
removein 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:HeapSizeReturn the approximate 'exclusive deep size' of implementing object. Includes count of payload and hosting object sizings. -
size
Description copied from interface:RegionSizeStoreReturns the number of entries in the store.- Specified by:
sizein interfaceRegionSizeStore- Returns:
- The number of entries in the store.
-
isEmpty
Description copied from interface:RegionSizeStoreReturns if the store is empty.- Specified by:
isEmptyin interfaceRegionSizeStore- Returns:
- true if there are no entries in the store, otherwise false.
-
clear
Description copied from interface:RegionSizeStoreRemoves all entries from the store.- Specified by:
clearin interfaceRegionSizeStore
-