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 long
capacity()
Returns the current size potential before a (maybe costly) rebuild becomes necessary.void
clear()
Clears all entries except those that are essential for a correctly executed program (e.g.void
clearAll()
Clears all entries, including those that are essential for a correctly executed program (e.g.DefaultObjectRegistry
Clone()
Useful forPersistenceContextDispatcher
.boolean
consolidate()
Consolidate internal data structures, e.g.boolean
containsObjectId(long objectId)
XGettingTable<String,HashStatisticsBucketBased>
createHashStatistics()
static float
defaultHashDensity()
boolean
ensureCapacity(long desiredCapacity)
Makes sure the internal storage structure is prepared to provide aPersistenceObjectRegistry.capacity()
of at least the passed capacity value.float
hashDensity()
int
hashRange()
boolean
isEmpty()
boolean
isValid(long objectId, Object object)
static boolean
isValidCapacity(long desiredCapacity)
static boolean
isValidHashDensity(float desiredHashDensity)
<A extends PersistenceAcceptor>
AiterateEntries(A acceptor)
Object
lookupObject(long objectId)
long
lookupObjectId(Object object)
long
minimumCapacity()
static DefaultObjectRegistry
New()
static DefaultObjectRegistry
New(float hashDensity)
static DefaultObjectRegistry
New(float hashDensity, long minimumCapacity)
Note on hashDensity: Reasonable values are within [0.75; 2.00].static DefaultObjectRegistry
New(long minimumCapacity)
Object
optionalRegisterObject(long objectId, Object object)
static void
printEntryInstanceSizeInfo()
boolean
registerConstant(long objectId, Object constant)
boolean
registerObject(long objectId, Object object)
boolean
setConfiguration(float hashDensity, long minimumCapacity)
boolean
setHashDensity(float hashDensity)
boolean
setMinimumCapacity(long minimumCapacity)
long
size()
void
truncate()
Truncates all entries except those that are essential for a correctly executed program (e.g.void
truncateAll()
Truncates all entries, including those that are essential for a correctly executed program (e.g.void
validate(long objectId, Object object)
static long
validateCapacity(long desiredCapacity)
static float
validateHashDensity(float desiredHashDensity)
-
Constructor Details
-
DefaultObjectRegistry
public DefaultObjectRegistry()
-
-
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:PersistenceObjectRegistry
Useful forPersistenceContextDispatcher
.- Specified by:
Clone
in interfaceCloneable<PersistenceObjectRegistry>
- Specified by:
Clone
in interfacePersistenceObjectRegistry
- Returns:
- A Clone of this instance as described in
Cloneable
.
-
hashRange
public final int hashRange()- Specified by:
hashRange
in interfacePersistenceObjectRegistry
-
hashDensity
public final float hashDensity()- Specified by:
hashDensity
in interfacePersistenceObjectRegistry
-
minimumCapacity
public final long minimumCapacity()- Specified by:
minimumCapacity
in interfacePersistenceObjectRegistry
-
capacity
public final long capacity()Description copied from interface:PersistenceObjectRegistry
Returns the current size potential before a (maybe costly) rebuild becomes necessary.- Specified by:
capacity
in interfacePersistenceObjectRegistry
-
size
public final long size()- Specified by:
size
in interfacePersistenceObjectRegistry
-
isEmpty
public final boolean isEmpty()- Specified by:
isEmpty
in interfacePersistenceObjectRegistry
-
setHashDensity
public final boolean setHashDensity(float hashDensity)- Specified by:
setHashDensity
in interfacePersistenceObjectRegistry
-
setConfiguration
public final boolean setConfiguration(float hashDensity, long minimumCapacity)- Specified by:
setConfiguration
in interfacePersistenceObjectRegistry
-
setMinimumCapacity
public final boolean setMinimumCapacity(long minimumCapacity)- Specified by:
setMinimumCapacity
in interfacePersistenceObjectRegistry
-
ensureCapacity
public final boolean ensureCapacity(long desiredCapacity)Description copied from interface:PersistenceObjectRegistry
Makes sure the internal storage structure is prepared to provide aPersistenceObjectRegistry.capacity()
of at least the passed capacity value.- Specified by:
ensureCapacity
in interfacePersistenceObjectRegistry
- Returns:
- whether a rebuild of internal storage structures was necessary.
-
containsObjectId
public final boolean containsObjectId(long objectId)- Specified by:
containsObjectId
in interfacePersistenceObjectRegistry
-
lookupObjectId
- Specified by:
lookupObjectId
in interfacePersistenceObjectIdLookup
- Specified by:
lookupObjectId
in interfacePersistenceObjectRegistry
-
lookupObject
- Specified by:
lookupObject
in interfacePersistenceObjectLookup
- Specified by:
lookupObject
in interfacePersistenceObjectRegistry
-
isValid
- Specified by:
isValid
in interfacePersistenceObjectRegistry
-
validate
- Specified by:
validate
in interfacePersistenceObjectRegistry
-
registerObject
- Specified by:
registerObject
in interfacePersistenceObjectRegistry
-
optionalRegisterObject
- Specified by:
optionalRegisterObject
in interfacePersistenceObjectRegistry
-
registerConstant
- Specified by:
registerConstant
in interfacePersistenceObjectRegistry
-
iterateEntries
- Specified by:
iterateEntries
in interfacePersistenceObjectRegistry
-
consolidate
public final boolean consolidate()Description copied from interface:PersistenceObjectRegistry
Consolidate 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:
consolidate
in interfacePersistenceObjectRegistry
- Returns:
- whether a rebuild was required.
-
clear
public final void clear()Description copied from interface:PersistenceObjectRegistry
Clears 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:
clear
in interfacePersistenceObjectRegistry
-
clearAll
public final void clearAll()Description copied from interface:PersistenceObjectRegistry
Clears 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:
clearAll
in interfacePersistenceObjectRegistry
-
truncate
public final void truncate()Description copied from interface:PersistenceObjectRegistry
Truncates 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:
truncate
in interfacePersistenceObjectRegistry
-
truncateAll
public final void truncateAll()Description copied from interface:PersistenceObjectRegistry
Truncates 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:
truncateAll
in interfacePersistenceObjectRegistry
-
createHashStatistics
- Specified by:
createHashStatistics
in interfacePersistenceObjectRegistry
-
printEntryInstanceSizeInfo
public static final void printEntryInstanceSizeInfo()
-