public class LazyRelationMap extends java.lang.Object implements java.io.Serializable, LazyMapI
Generally the collection can work on both sides of the connection (i.e. in the access area of Castor and on the client). The transport mechanism just has to provide an instance of a loading mechanism for the incoming value, which allows the collection to load the missing values.
The collection has three states:
| Constructor and Description |
|---|
LazyRelationMap(BO _parentBO,
java.lang.String _attributeName) |
LazyRelationMap(java.util.Collection r,
BO _parentBO,
java.lang.String _attributeName) |
LazyRelationMap(java.util.TreeMap t,
BO _parentBO,
java.lang.String _attributeName) |
| Modifier and Type | Method and Description |
|---|---|
void |
__unlazy(java.util.concurrent.CompletableFuture future,
java.util.TreeMap resultMap) |
void |
addRelationObject(BO value) |
void |
clear()
Removes all mappings from this map (optional operation, currently unsupported).
|
boolean |
clearLazyChanges()
Clears out any lazy changes persisted in this, still lazy, map.
|
java.util.SortedMap |
cloneInternalMap()
Forces the lazy loading of this lazy map, if it hasn't occurred already, and returns a shallow copy
of the internal map that backs this lazy map.
|
boolean |
containsKey(java.lang.Object key)
Returns true if this map contains a mapping for the specified key.
|
boolean |
containsValue(java.lang.Object value)
Returns true if this map maps one or more keys to the specified value.
|
java.lang.String |
debugCtx() |
java.util.Set |
entrySet()
Returns a set view of the mappings contained in this map.
|
java.lang.Object |
get(java.lang.Object key)
Returns the value to which this map maps the specified key.
|
java.lang.String |
getAttributeName()
The attribute name this LazyRelationMap is accessible from its parent BO
|
java.util.Collection |
getCollection() |
RetainedChanges |
getLazyChanges() |
BO |
getParentBO()
The parent BO for this LazyRelationMap
|
boolean |
hasEssentialInfos() |
boolean |
hasLazyChanges() |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings.
|
boolean |
isLazy()
Returns
true if the map has not yet been populated with values,
or if an asynchronous loading task is pending, cancelled or failed. |
boolean |
isUnLazyBeforeTransport() |
boolean |
isUnlazyFailed()
Returns
true if an asynchronous unlazy attempt terminated abnormally. |
java.util.Set |
keySet()
Returns a set view of the keys contained in this map.
|
int |
lazySize()
Returns the number of key-value mappings in this map without necessarily unlazying it.
|
java.util.Collection |
pgetCollection()
this method is exclusively used in Castor context
|
java.lang.Object |
probabilityContainer(java.lang.String reason,
boolean readonly)
This routine is similar to the containsKey method, but it is "probably", i.e. not 100% sure.
|
boolean |
probablyContainsKey(java.lang.Object key,
boolean ifLazy)
The difficult thing about this routine is that it is ALWAYS called by the BOs
to fill the dilateral Collections and to manage them mutually.
|
boolean |
probablyContainsValue(java.lang.Object value,
boolean ifLazy) |
java.lang.Object |
probablyGet(java.lang.Object key)
Here we are not really interested in the LazyColl.
|
void |
probablyPut(java.lang.Object key,
java.lang.Object value)
For put and get we must always inform a lazyColl, if it is usable.
|
void |
probablyRemove(java.lang.Object key,
java.lang.Object value) |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Associates the specified value with the specified key in this map (optional operation).
|
void |
putAll(java.util.Map t)
Copies all of the mappings from the specified map to this map (optional operation).
|
java.lang.Object |
remove(java.lang.Object key)
Removes the mapping for this key from this map if it is present (optional operation).
|
void |
removeRelationObject(BO value) |
boolean |
resetFailedUnlazy()
Resets an exceptionally terminated or cancelled unlazy task back to an unpopulated (lazy) state.
|
void |
setUnLazyBeforeTransport(boolean $18) |
int |
size()
Returns the number of key-value mappings in this map.
|
int |
sizeFast()
Deprecated.
replaced by
lazySize() |
java.lang.String |
toString() |
java.lang.String |
toString(boolean novalues) |
java.util.Map |
unLazy()
Materializes the relation map synchronously or awaits an in-flight unlazy operation.
|
java.util.Map |
unLazy(java.lang.String reason) |
java.util.Collection |
values()
Returns a collection view of the values contained in this map.
|
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitisLazy, lazyIsEmptypublic LazyRelationMap(BO _parentBO, java.lang.String _attributeName)
public LazyRelationMap(java.util.TreeMap t,
BO _parentBO,
java.lang.String _attributeName)
public LazyRelationMap(java.util.Collection r,
BO _parentBO,
java.lang.String _attributeName)
public java.lang.String getAttributeName()
public BO getParentBO()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(boolean novalues)
public java.lang.String debugCtx()
public boolean hasEssentialInfos()
public boolean isLazy()
true if the map has not yet been populated with values,
or if an asynchronous loading task is pending, cancelled or failed.
A return value of true indicates either that population has not
yet completed (unpopulated state or pending CompletableFuture) or that
an in-flight future terminated abnormally via cancellation or an uncaught exception,
meaning no resolved map data is available.
public boolean isUnlazyFailed()
true if an asynchronous unlazy attempt terminated abnormally.
Evaluates to true solely when the backing CompletableFuture
failed due to an uncaught exception or explicit cancellation. Returns false
while loading is pending, if the map remains lazy or if materialization completed
successfully.
true if unlazying failed or was cancelled; false otherwisepublic boolean resetFailedUnlazy()
Performs an atomic compare-and-set to replace a failed CompletableFuture with null,
clearing internalMap to allow a subsequent unlazy attempt. Does nothing if the current value
is not a failed future (e.g. if still pending, already completed successfully or already reset).
Callers should manage retry policies explicitly to avoid repeated reset cycles on persistent failures.
true if the map was atomically reset to an unpopulated state;
false if no failed future was present or another thread updated the state firstpublic boolean hasLazyChanges()
public RetainedChanges getLazyChanges()
public boolean clearLazyChanges()
public java.util.Map unLazy()
If the relation has already materialized, this method returns the populated Map
immediately. If another thread is actively resolving the collection, this thread awaits
that Future via awaitFutureUnchecked(Future, String).
When this thread initiates the unlazy process, it registers an UnlazyingCompletableFuture
in VALUE via compare-and-set and executes _unlazy(UnlazyingCompletableFuture)
synchronously on the current thread. Synchronous execution is mandatory to prevent Castor's
LockEngine from detecting cross-thread transaction lock dependencies, which otherwise
trigger false-positive deadlock aborts (locks are associated with threads in Castor).
reason - descriptive caller context for tracing and diagnostics (e.g. "beforeTransport")java.lang.IllegalStateException - if an unrecoverable data integrity error or incomplete hydration occursIRuntimeException - if the thread was interrupted or the operation failed unexpectedlypublic java.util.Map unLazy(java.lang.String reason)
public void __unlazy(java.util.concurrent.CompletableFuture future,
java.util.TreeMap resultMap)
public java.util.Collection pgetCollection()
public java.util.Collection getCollection()
public java.util.SortedMap cloneInternalMap()
LazyMapIcloneInternalMap in interface LazyMapISortedMap containing the key-value mappings of this lazy map.public void clear()
clear in interface java.util.Mappublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Mappublic boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Mappublic java.util.Set entrySet()
entrySet in interface java.util.Mappublic java.lang.Object get(java.lang.Object key)
get in interface java.util.Mappublic boolean isEmpty()
isEmpty in interface java.util.Mappublic java.util.Set keySet()
keySet in interface java.util.Mappublic java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mappublic void putAll(java.util.Map t)
putAll in interface java.util.Mappublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mappublic int size()
size in interface java.util.Mappublic java.util.Collection values()
values in interface java.util.Mappublic java.lang.Object probabilityContainer(java.lang.String reason,
boolean readonly)
public boolean probablyContainsKey(java.lang.Object key,
boolean ifLazy)
public boolean probablyContainsValue(java.lang.Object value,
boolean ifLazy)
public java.lang.Object probablyGet(java.lang.Object key)
public void probablyPut(java.lang.Object key,
java.lang.Object value)
public void probablyRemove(java.lang.Object key,
java.lang.Object value)
public int lazySize()
@Deprecated public int sizeFast()
lazySize()public void addRelationObject(BO value)
public void removeRelationObject(BO value)
public boolean isUnLazyBeforeTransport()
public void setUnLazyBeforeTransport(boolean $18)
Copyright © 2000-2026 OAshi S.à r.l. All Rights Reserved.