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
-
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()booleanisValid(long objectId, Object object)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.voidvalidate(long objectId, Object object)static longvalidateCapacity(long desiredCapacity)static floatvalidateHashDensity(float desiredHashDensity)
-
Method Details
-
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
-
New
-
New
-
New
Note on hashDensity: Reasonable values are within [0.75; 2.00].- Parameters:
hashDensity-minimumCapacity-
-
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
- Specified by:
lookupObjectIdin interfacePersistenceObjectIdLookup- Specified by:
lookupObjectIdin interfacePersistenceObjectRegistry
-
lookupObject
- Specified by:
lookupObjectin interfacePersistenceObjectLookup- Specified by:
lookupObjectin interfacePersistenceObjectRegistry
-
isValid
- Specified by:
isValidin interfacePersistenceObjectRegistry
-
validate
- Specified by:
validatein interfacePersistenceObjectRegistry
-
registerObject
- Specified by:
registerObjectin interfacePersistenceObjectRegistry
-
optionalRegisterObject
- Specified by:
optionalRegisterObjectin interfacePersistenceObjectRegistry
-
registerConstant
- Specified by:
registerConstantin interfacePersistenceObjectRegistry
-
iterateEntries
- 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.NOTE:
This method is currently only intended to be used for testing since calling it can cause inconsistencies if there still exist uncleared lazy references.- 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.NOTE:
This method is currently only intended to be used for testing since calling it can cause inconsistencies if there still exist uncleared lazy references.- 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.NOTE:
This method is currently only intended to be used for testing since calling it can cause inconsistencies if there still exist uncleared lazy references.- 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.NOTE:
This method is currently only intended to be used for testing since calling it can cause inconsistencies if there still exist uncleared lazy references.- Specified by:
truncateAllin interfacePersistenceObjectRegistry
-
createHashStatistics
- Specified by:
createHashStatisticsin interfacePersistenceObjectRegistry
-
printEntryInstanceSizeInfo
public static final void printEntryInstanceSizeInfo()
-