Package jmri.util
Class PropertyChangeEventQueue
- java.lang.Object
-
- jmri.util.PropertyChangeEventQueue
-
@ThreadSafe public class PropertyChangeEventQueue extends java.lang.Object
Gathers PropertyChangeEvents that might occur in overlapping threads and at overlapping times, presenting them as requested.Listeners are installed when the object is constructed.
dispose()
detaches those listeners, after which the object should not be used. It is not an error to calldispose()
multiple times.Although this could be more generic than NamedBean, there's no single interface that specifies "can call addPropertyChangeListener(..)".
-
-
Constructor Summary
Constructors Constructor Description PropertyChangeEventQueue(java.util.Collection<NamedBean> collection)
PropertyChangeEventQueue(NamedBean[] array)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Dispose by dropping the listeners to all the specifiedNamedBean
s.java.beans.PropertyChangeEvent
poll(long timeout, java.util.concurrent.TimeUnit unit)
java.beans.PropertyChangeEvent
take()
java.lang.String
toString()
-
-
-
Constructor Detail
-
PropertyChangeEventQueue
public PropertyChangeEventQueue(@Nonnull java.util.Collection<NamedBean> collection)
- Parameters:
collection
- Set of NamedBeans whose events should be handled. Keeps a copy of the contents, so future changes irrelevant.
-
PropertyChangeEventQueue
public PropertyChangeEventQueue(@Nonnull NamedBean[] array)
- Parameters:
array
- Set of NamedBeans whose events should be handled Keeps a copy of the contents, so future changes irrelevant.
-
-
Method Detail
-
dispose
public void dispose()
Dispose by dropping the listeners to all the specifiedNamedBean
s. The object should not be used again after calling this. It is not an error to call this multiple times.
-
take
public java.beans.PropertyChangeEvent take() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
poll
public java.beans.PropertyChangeEvent poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-