void addListener(DomainObjectListener listener) {

		if (isDisposed) {
			return;
		}

		withLock(() -> {

			// Capture the pending event to send to the existing listeners.  This prevents the new
			// listener from getting events registered before the listener was added.  Also, create
			// a new set of listeners so that any events already posted to the Swing thread do not
			// see the newly added listener.
			Collection<DomainObjectListener> previousListeners = listeners.values();
			listeners.add(listener);

			DomainObjectChangedEvent pendingEvent = createEventFromQueuedRecords();
			if (pendingEvent != null) {
				notificationQueue.add(new EventNotification(pendingEvent, previousListeners));
				timer.start();
			}
		});
	}
Constructs a new DomainObjectChangeSupport object.

@param src The object to be put as the src for all events generated.
@param timeInterval The time (in milliseconds) this object will wait before flushing its
event buffer. If a new event comes in before the time expires, the timer is reset.
@param lock the lock used to verify that calls to {@link #flush()} are not performed while a
lock is held; this is the lock to guard the DB
Ghidra/Framework/Project/src/main/java/ghidra/framework/data/DomainObjectChangeSupport.java