public static final class SubjectManager.Implementation extends Object implements SubjectManager
SubjectManager
default implementation that uses a shared synchronization lock and a
LockedMap
implementation to allow locking-supervised access to the registry entries.SubjectManager.Implementation
Modifier and Type | Method and Description |
---|---|
Object |
lockSubjectRegistry()
Returns the lock instance that is internally used by this registry instance.
|
Subject |
subject(String subjectName)
Returns the
Subject instance identified by the passed subject name. |
Map<String,Subject> |
subjects()
Provides access to the registry entries to be used in a thread safe way according to the internal
logic.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
New, New, New, New
New, New, New
public Map<String,Subject> subjects()
LockedMap
.
Rationale for this approach: The obvious (and naive) concept would be to implement a registerSubject() method. But as a consequence, that would also require a removeSubject() method, then a subjectSize() and iterateSubjects() methods and then it becomes clear that managing subjects (in an efficient, comfortable way) requires a complete collection logic. So instead of reimplementing a complete collection in every managing type, the managing type might as well provide mutating access to its internal collection, however in a safe way (e.g. wrapped in locking logic and/or via a relay instance with hooked-in logic).
subjects
in interface SubjectManager
subjects
in interface SubjectRegistry
public Subject subject(String subjectName)
Subject
instance identified by the passed subject name.subject
in interface SubjectRegistry
subjectName
- the name identifying the desired Subject
instance.Subject
instance identified by the passed name.public Object lockSubjectRegistry()
lockSubjectRegistry
in interface SubjectRegistry