The tutorial chapter on concurrency introduces the locking basics as well as
Keep in mind that you should also lock your root list during
construction of list pipelines, when multiple threads are used
CompositeList and locking
CompositeList is composed of multiple source EventLists.
All contained EventLists must use the same
ReadWriteLock as the CompositeList, particularly if this list is to be used by multiple threads
concurrently. To construct an EventList that shares the publisher and lock with the CompositeList,
CompositeList#createMemberList() can be used.
CollectionList and locking
CollectionList uses an instance of type
to determine the list of children for each list element of the source
list. If the model returns an EventList of children, it must use the
same lock and ListEventPublisher as the CollectionList (and its source
If you are using multiple threads and you want to debug some things, you can use the
DebugList as a drop-in replacement for
BasicEventList. It must be configured to check for the kind of errors you're interested in. The two types of errors it can report are:
setLockCheckingEnabled(true) will ensure that each read/write is guarded by the appropriate lock.
indicates that the current Thread (and ONLY the current Thread) should
ever read/write from the given DebugList. This is useful when you want
to guarantee things like "only my data loader Thread writes into the
list pipeline" or "only the Swing EDT reads from the list pipeline",