File tree Expand file tree Collapse file tree 3 files changed +17
-11
lines changed
main/java/org/scijava/task
test/java/org/scijava/task Expand file tree Collapse file tree 3 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public class DefaultTask implements Task {
92
92
* reported.
93
93
*/
94
94
public DefaultTask (final ThreadService threadService ,
95
- final EventService eventService )
95
+ final EventService eventService )
96
96
{
97
97
this .threadService = threadService ;
98
98
this .eventService = eventService ;
@@ -123,7 +123,7 @@ public void start() {
123
123
// - Synchronous
124
124
@ Override
125
125
public void finish () {
126
- isDone = true ;
126
+ isDone = true ;
127
127
fireTaskEvent ();
128
128
}
129
129
@@ -176,12 +176,12 @@ public boolean isCanceled() {
176
176
public void cancel (final String reason ) {
177
177
canceled = true ;
178
178
cancelReason = reason ;
179
- if (cancelCallBack != null ) cancelCallBack .run ();
179
+ if (cancelCallBack != null ) cancelCallBack .run ();
180
180
fireTaskEvent ();
181
181
}
182
182
183
183
void defaultCancelCallback () {
184
- if (future != null ) {
184
+ if (future != null ) {
185
185
isDone = future .cancel (true );
186
186
}
187
187
}
@@ -231,9 +231,11 @@ private synchronized void initFuture(final Runnable r) {
231
231
try {
232
232
fireTaskEvent (); // Triggers an event just before the task is executed
233
233
r .run ();
234
- } finally {
234
+ }
235
+ finally {
235
236
isDone = true ;
236
- fireTaskEvent (); // Triggers an event just after the task has successfully completed or failed
237
+ fireTaskEvent (); // Triggers an event just after the task has
238
+ // successfully completed or failed
237
239
}
238
240
});
239
241
}
Original file line number Diff line number Diff line change @@ -137,15 +137,18 @@ default void finish() {}
137
137
* If the task is cancelled (external call to {@link Task#cancel(String)}),
138
138
* the input runnable argument should be executed by task implementors.
139
139
*
140
- * @param runnable : should be executed if this task is cancelled through {@link Task#cancel(String)}
140
+ * @param runnable : should be executed if this task is cancelled through
141
+ * {@link Task#cancel(String)}
141
142
*/
142
143
default void setCancelCallBack (Runnable runnable ) {}
143
144
144
145
/**
145
- * Returns the current cancel callback runnable,
146
- * This can be used to concatenate callbacks in order,
147
- * for instance, to ask for a user confirmation before cancelling the task
146
+ * Returns the current cancel callback runnable, This can be used to
147
+ * concatenate callbacks in order, for instance, to ask for a user
148
+ * confirmation before cancelling the task
148
149
*/
149
- default Runnable getCancelCallBack () { return () -> {}; }
150
+ default Runnable getCancelCallBack () {
151
+ return () -> {};
152
+ }
150
153
151
154
}
Original file line number Diff line number Diff line change 26
26
* POSSIBILITY OF SUCH DAMAGE.
27
27
* #L%
28
28
*/
29
+
29
30
package org .scijava .task ;
30
31
31
32
import static org .junit .Assert .assertEquals ;
You can’t perform that action at this time.
0 commit comments