File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
src/main/java/org/scijava/thread Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,16 @@ public Future<?> run(final Runnable code) {
8383 return executor ().submit (wrap (code ));
8484 }
8585
86+ @ Override
87+ public ExecutorService getExecutorService () {
88+ return executor ();
89+ }
90+
91+ @ Override
92+ public void setExecutorService (final ExecutorService executor ) {
93+ this .executor = executor ;
94+ }
95+
8696 @ Override
8797 public boolean isDispatchThread () {
8898 return EventQueue .isDispatchThread ();
Original file line number Diff line number Diff line change 3333
3434import java .lang .reflect .InvocationTargetException ;
3535import java .util .concurrent .Callable ;
36+ import java .util .concurrent .ExecutorService ;
3637import java .util .concurrent .Future ;
3738import java .util .concurrent .ThreadFactory ;
3839
@@ -91,6 +92,24 @@ public enum ThreadContext {
9192 */
9293 Future <?> run (Runnable code );
9394
95+ /**
96+ * Gets the {@link ExecutorService} object used when {@link #run} is called.
97+ *
98+ * @return the {@link ExecutorService}, or null if an {@link ExecutorService}
99+ * is not used in this {@link ThreadService} implementation.
100+ */
101+ ExecutorService getExecutorService ();
102+
103+ /**
104+ * Sets the {@link ExecutorService} object used when {@link #run} is called.
105+ *
106+ * @param executor The {@link ExecutorService} for this {@link ThreadService}
107+ * to use internally for {@link #run} calls.
108+ * @throws UnsupportedOperationException if this {@link ThreadService} does
109+ * not use an {@link ExecutorService} to handle {@link #run} calls.
110+ */
111+ void setExecutorService (ExecutorService executor );
112+
94113 /**
95114 * Gets whether the current thread is a dispatch thread for use with
96115 * {@link #invoke} and {@link #queue}.
You can’t perform that action at this time.
0 commit comments