Class DefaultObjectRegistry
- java.lang.Object
-
- one.microstream.persistence.internal.DefaultObjectRegistry
-
- All Implemented Interfaces:
PersistenceObjectIdLookup,PersistenceObjectLookup,PersistenceObjectRegistry,PersistenceSwizzlingLookup,Cloneable<PersistenceObjectRegistry>
public final class DefaultObjectRegistry extends Object implements PersistenceObjectRegistry
-
-
Constructor Summary
Constructors Constructor Description DefaultObjectRegistry()
-
Method Summary
Modifier and Type Method Description longcapacity()Returns the current size potential before a (maybe costly) rebuild becomes necessary.voidclear()Clears all entries except those that are essential for a correctly executed program (e.g.voidclearAll()Clears all entries, including those that are essential for a correctly executed program (e.g.DefaultObjectRegistryClone()Useful forPersistenceContextDispatcher.booleanconsolidate()Consolidate internal data structures, e.g.booleancontainsObjectId(long objectId)XGettingTable<String,HashStatisticsBucketBased>createHashStatistics()static floatdefaultHashDensity()booleanensureCapacity(long desiredCapacity)Makes sure the internal storage structure is prepared to provide aPersistenceObjectRegistry.capacity()of at least the passed capacity value.floathashDensity()inthashRange()booleanisEmpty()static booleanisValidCapacity(long desiredCapacity)static booleanisValidHashDensity(float desiredHashDensity)<A extends PersistenceAcceptor>
AiterateEntries(A acceptor)ObjectlookupObject(long objectId)longlookupObjectId(Object object)longminimumCapacity()static DefaultObjectRegistryNew()static DefaultObjectRegistryNew(float hashDensity)static DefaultObjectRegistryNew(float hashDensity, long minimumCapacity)Note on hashDensity: Reasonable values are within [0.75; 2.00].static DefaultObjectRegistryNew(long minimumCapacity)ObjectoptionalRegisterObject(long objectId, Object object)static voidprintEntryInstanceSizeInfo()booleanregisterConstant(long objectId, Object constant)booleanregisterObject(long objectId, Object object)booleansetConfiguration(float hashDensity, long minimumCapacity)booleansetHashDensity(float hashDensity)booleansetMinimumCapacity(long minimumCapacity)longsize()voidtruncate()Truncates all entries except those that are essential for a correctly executed program (e.g.voidtruncateAll()Truncates all entries, including those that are essential for a correctly executed program (e.g.static longvalidateCapacity(long desiredCapacity)static floatvalidateHashDensity(float desiredHashDensity)
-
-
-
Method Detail
-
defaultHashDensity
public static final float defaultHashDensity()
-
isValidHashDensity
public static final boolean isValidHashDensity(float desiredHashDensity)
-
validateHashDensity
public static final float validateHashDensity(float desiredHashDensity)
-
isValidCapacity
public static final boolean isValidCapacity(long desiredCapacity)
-
validateCapacity
public static final long validateCapacity(long desiredCapacity)
-
New
public static DefaultObjectRegistry New()
-
New
public static DefaultObjectRegistry New(long minimumCapacity)
-
New
public static DefaultObjectRegistry New(float hashDensity)
-
New
public static DefaultObjectRegistry New(float hashDensity, long minimumCapacity)
Note on hashDensity: Reasonable values are within [0.75; 2.00].- Parameters:
hashDensity-minimumCapacity-
-
Clone
public final DefaultObjectRegistry Clone()
Description copied from interface:PersistenceObjectRegistryUseful forPersistenceContextDispatcher.- Specified by:
Clonein interfaceCloneable<PersistenceObjectRegistry>- Specified by:
Clonein interfacePersistenceObjectRegistry- Returns:
- A Clone of this instance as described in
Cloneable.
-
hashRange
public final int hashRange()
- Specified by:
hashRangein interfacePersistenceObjectRegistry
-
hashDensity
public final float hashDensity()
- Specified by:
hashDensityin interfacePersistenceObjectRegistry
-
minimumCapacity
public final long minimumCapacity()
- Specified by:
minimumCapacityin interfacePersistenceObjectRegistry
-
capacity
public final long capacity()
Description copied from interface:PersistenceObjectRegistryReturns the current size potential before a (maybe costly) rebuild becomes necessary.- Specified by:
capacityin interfacePersistenceObjectRegistry
-
size
public final long size()
- Specified by:
sizein interfacePersistenceObjectRegistry
-
isEmpty
public final boolean isEmpty()
- Specified by:
isEmptyin interfacePersistenceObjectRegistry
-
setHashDensity
public final boolean setHashDensity(float hashDensity)
- Specified by:
setHashDensityin interfacePersistenceObjectRegistry
-
setConfiguration
public final boolean setConfiguration(float hashDensity, long minimumCapacity)- Specified by:
setConfigurationin interfacePersistenceObjectRegistry
-
setMinimumCapacity
public final boolean setMinimumCapacity(long minimumCapacity)
- Specified by:
setMinimumCapacityin interfacePersistenceObjectRegistry
-
ensureCapacity
public final boolean ensureCapacity(long desiredCapacity)
Description copied from interface:PersistenceObjectRegistryMakes sure the internal storage structure is prepared to provide aPersistenceObjectRegistry.capacity()of at least the passed capacity value.- Specified by:
ensureCapacityin interfacePersistenceObjectRegistry- Returns:
- whether a rebuild of internal storage structures was necessary.
-
containsObjectId
public final boolean containsObjectId(long objectId)
- Specified by:
containsObjectIdin interfacePersistenceObjectRegistry
-
lookupObjectId
public final long lookupObjectId(Object object)
- Specified by:
lookupObjectIdin interfacePersistenceObjectIdLookup- Specified by:
lookupObjectIdin interfacePersistenceObjectRegistry
-
lookupObject
public final Object lookupObject(long objectId)
- Specified by:
lookupObjectin interfacePersistenceObjectLookup- Specified by:
lookupObjectin interfacePersistenceObjectRegistry
-
registerObject
public final boolean registerObject(long objectId, Object object)- Specified by:
registerObjectin interfacePersistenceObjectRegistry
-
optionalRegisterObject
public final Object optionalRegisterObject(long objectId, Object object)
- Specified by:
optionalRegisterObjectin interfacePersistenceObjectRegistry
-
registerConstant
public final boolean registerConstant(long objectId, Object constant)- Specified by:
registerConstantin interfacePersistenceObjectRegistry
-
iterateEntries
public final <A extends PersistenceAcceptor> A iterateEntries(A acceptor)
- Specified by:
iterateEntriesin interfacePersistenceObjectRegistry
-
consolidate
public final boolean consolidate()
Description copied from interface:PersistenceObjectRegistryConsolidate internal data structures, e.g. by removing orphan entries and empty hash chains. Depending on the implementation and the size of the registry, this can take a considerable amount of time.- Specified by:
consolidatein interfacePersistenceObjectRegistry- Returns:
- whether a rebuild was required.
-
clear
public final void clear()
Description copied from interface:PersistenceObjectRegistryClears all entries except those that are essential for a correctly executed program (e.g. constants). Clearing means to leave the current capacity as it is and just to actually clear its entries.- Specified by:
clearin interfacePersistenceObjectRegistry
-
clearAll
public final void clearAll()
Description copied from interface:PersistenceObjectRegistryClears all entries, including those that are essential for a correctly executed program (e.g. constants), effectively leaving a completely empty registry. Clearing means to leave the current capacity as it is and just to actually clear its entries.- Specified by:
clearAllin interfacePersistenceObjectRegistry
-
truncate
public final void truncate()
Description copied from interface:PersistenceObjectRegistryTruncates all entries except those that are essential for a correctly executed program (e.g. constants). Truncating means to quickly empty the registry by reinitializing the internal storage structures with a new and minimal capacity.- Specified by:
truncatein interfacePersistenceObjectRegistry
-
truncateAll
public final void truncateAll()
Description copied from interface:PersistenceObjectRegistryTruncates all entries, including those that are essential for a correctly executed program (e.g. constants), effectively leaving a completely empty registry. Truncating means to quickly empty the registry by reinitializing the internal storage structures with a new and minimal capacity.- Specified by:
truncateAllin interfacePersistenceObjectRegistry
-
createHashStatistics
public final XGettingTable<String,HashStatisticsBucketBased> createHashStatistics()
- Specified by:
createHashStatisticsin interfacePersistenceObjectRegistry
-
printEntryInstanceSizeInfo
public static final void printEntryInstanceSizeInfo()
-
-