ThreadsafeMetaDataContainer (object)¶
The ThreadsafeMetaDataContainer can be used to store any number of KL objects in a dictionary in a thread safe fashion.
Members¶
Versions | version | |
SimpleLock | simpleLock | The container’s lock |
Methods¶
ThreadsafeMetaDataContainer ( in ThreadsafeMetaDataContainer other ) | |
ThreadsafeMetaDataContainer () | |
ThreadsafeMetaDataContainer | clone ? () |
Ref<Object> | get ? ( in String name ) |
Ref<Object> | getOrCreate ! ( in String name, in Type type ) |
Boolean | has ? ( in String name ) |
Ref<Object> | lockedGet ? ( in String name ) |
lockedSet ! ( in String name, in Object value ) | |
Boolean | remove ! ( in String name ) |
set ! ( in String name, in Object value ) |
Methods in detail¶
ThreadsafeMetaDataContainer ( in ThreadsafeMetaDataContainer other )
copy constructor
ThreadsafeMetaDataContainer ThreadsafeMetaDataContainer.clone? ()
clone method
Ref<Object> ThreadsafeMetaDataContainer.get? ( in String name )
gets a single object out of the container or null if it doesn’t exist
Ref<Object> ThreadsafeMetaDataContainer.getOrCreate! ( in String name, in Type type )
gets an object from of the, or creates one of the provided type it doesn’t exist.
type | An instance of that object type will be created if required |
Boolean ThreadsafeMetaDataContainer.has? ( in String name )
Returns true if the data exists
Ref<Object> ThreadsafeMetaDataContainer.lockedGet? ( in String name )
gets a single object out of the container or null if it doesn’t exist, but expects this container to be locked already.
ThreadsafeMetaDataContainer.lockedSet! ( in String name, in Object value )
sets a single object in the container and expects this container to be locked already.
注釈
When setting the data container value, it needs to be locked externally, so the value creation is protected too under that same lock (avoids to lock twice). Preferred method is to build a local AutoLock AL(metaData.lock);
Boolean ThreadsafeMetaDataContainer.remove! ( in String name )
removes a single KL object from this container
ThreadsafeMetaDataContainer.set! ( in String name, in Object value )