Skip to content

Commit

Permalink
TaskRunner: reduce duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
bwRavencl committed Dec 30, 2024
1 parent 23d4825 commit a7678dc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/java/de/bwravencl/controllerbuddy/gui/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -3762,9 +3762,7 @@ private boolean isTaskOfTypeRunning(final Class<?> clazz) {

@SuppressWarnings("unchecked")
private <V> Optional<V> run(final Callable<V> callable) {
waitForTask();

task = callable;
setTask(callable);

try {
synchronized (this) {
Expand All @@ -3786,8 +3784,13 @@ private <V> Optional<V> run(final Callable<V> callable) {
}

private void run(final Runnable runnable) {
setTask(runnable);
}

private void setTask(final Object task) {
waitForTask();
task = runnable;

this.task = task;
}

private void shutdown() {
Expand Down

0 comments on commit a7678dc

Please sign in to comment.