public GScheduledTask scheduleTask(GTask task, int priority, boolean useCurrentGroup) {
		GScheduledTask newTask;
		lock.lock();
		try {
			// if there is a current group running and this task can use the current group
			// add it to the current running group
			if (useCurrentGroup && runningGroup != null) {
				newTask = runningGroup.doAddTask(task, priority);
				priorityQ.add(newTask);
				notifyTaskScheduled(newTask);
			}
			// else if we can't use the current group or there is no groups at all
			// create a new group
			else if (taskGroupList.isEmpty() || !useCurrentGroup) {
				GTaskGroup group = new GTaskGroup(task.getName(), true);
				newTask = group.doAddTask(task, priority);
				taskGroupList.add(group);
				notifyTaskGroupScheduled(group);
			}
			// else add it to the first group  (can only happen if queue is paused)
			else {
				GTaskGroup group = taskGroupList.getFirst();
				newTask = group.doAddTask(task, priority);
				notifyTaskScheduled(newTask);
			}
			isBusy.signal();
			runNextTaskIfNotBusyOrSuspended();
		}
		finally {
			lock.unlock();
		}
		return newTask;
	}
Schedules a task to be run by this TaskManager. Tasks are run one at a time.

@param task the task to be run.
@param priority the priority of the task.  Lower numbers are run before higher numbers.
@param useCurrentGroup If true, this task will be rolled into the current transaction group
							if one exists.  If false, any open transaction 
							will be closed and a new transaction will be opened before 
							this task is run.
@return scheduled task
Ghidra/Framework/Project/src/main/java/ghidra/framework/task/GTaskManager.java