Skip to content

Commit fa44b11

Browse files
committed
Make Task.parent() protected
We want to propagate progress updates up the chain of subtasks, so tasks must know their parent, at least within the scijava-progress module. To avoid publicly exposing this functionality, though, we make a new method isSubTask which allows us to optionally disregard all subtasks.
1 parent e488315 commit fa44b11

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

scijava-ops-legacy/src/main/java/org/scijava/legacy/service/DefaultOpEnvironmentService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public SciJavaProgressListener(TaskService tasks) {
8686

8787
@Override
8888
public void acknowledgeUpdate(Task task) {
89-
if (task.parent() != null) return;
89+
if (task.isSubTask()) return;
9090
var sjTask = taskMap.computeIfAbsent( //
9191
task, //
9292
(t) -> { //

scijava-progress/src/main/java/org/scijava/progress/Task.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@ public Object progressible() {
250250
*
251251
* @return the parent {@link Task}, or {@code null} if this Task has no parent
252252
*/
253-
public Task parent() {
253+
protected Task parent() {
254254
return parent;
255255
}
256+
257+
public boolean isSubTask() {
258+
return parent != null;
259+
}
256260
}

0 commit comments

Comments
 (0)