File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/main/java/org/scijava/module/process Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 3131
3232package org .scijava .module .process ;
3333
34+ import org .scijava .Cancelable ;
3435import org .scijava .Priority ;
3536import org .scijava .log .LogService ;
3637import org .scijava .module .MethodCallException ;
@@ -58,6 +59,7 @@ public class InitPreprocessor extends AbstractPreprocessorPlugin {
5859 public void process (final Module module ) {
5960 try {
6061 module .initialize ();
62+ if (isCanceled (module )) cancel (getCancelReason (module ));
6163 }
6264 catch (final MethodCallException exc ) {
6365 if (log != null ) log .error (exc );
@@ -66,4 +68,16 @@ public void process(final Module module) {
6668 }
6769 }
6870
71+ // -- Helper methods --
72+
73+ private boolean isCanceled (final Module module ) {
74+ return module instanceof Cancelable && ((Cancelable ) module ).isCanceled ();
75+ }
76+
77+ private String getCancelReason (final Module module ) {
78+ if (!(module instanceof Cancelable )) return null ;
79+ final String cancelReason = ((Cancelable ) module ).getCancelReason ();
80+ return cancelReason == null ? "" : cancelReason ;
81+ }
82+
6983}
You can’t perform that action at this time.
0 commit comments