protected void notifyTaskListeners(final boolean wasCancelled) {
		if (listeners.isEmpty()) {
			return;
		}

		Runnable r = () -> {
			for (TaskListener listener : listeners) {
				if (wasCancelled) {
					listener.taskCancelled(Task.this);
				}
				else {
					listener.taskCompleted(Task.this);
				}
			}
		};

		if (waitForTaskCompleted) {
			Swing.runNow(r);
		}
		else {
			Swing.runLater(r);
		}
	}
When an object implementing interface <code>Runnable</code> is used to create a thread,
starting the thread causes the object's <code>run</code> method to be called in that
separately executing thread.

@param monitor the task monitor
Ghidra/Framework/Gui/src/main/java/ghidra/util/task/Task.java