File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/main/java/org/scijava/startup Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 3535import java .util .ArrayDeque ;
3636import java .util .Deque ;
3737
38+ import org .scijava .log .LogService ;
39+ import org .scijava .plugin .Parameter ;
3840import org .scijava .plugin .Plugin ;
3941import org .scijava .service .AbstractService ;
4042import org .scijava .service .Service ;
@@ -51,6 +53,9 @@ public class DefaultStartupService extends AbstractService implements
5153
5254 private final Deque <Runnable > operations = new ArrayDeque <>();
5355
56+ @ Parameter (required = false )
57+ private LogService log ;
58+
5459 @ Override
5560 public void addOperation (final Runnable operation ) {
5661 operations .add (operation );
@@ -60,7 +65,12 @@ public void addOperation(final Runnable operation) {
6065 public void executeOperations () {
6166 while (!operations .isEmpty ()) {
6267 final Runnable operation = operations .pop ();
63- operation .run ();
68+ try {
69+ operation .run ();
70+ }
71+ catch (final RuntimeException exc ) {
72+ if (log != null ) log .error (exc );
73+ }
6474 }
6575 }
6676}
You can’t perform that action at this time.
0 commit comments