MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / joinAll

Method joinAll

ij/src/main/java/ij/util/ThreadUtil.java:128–148  ·  view source on GitHub ↗

Waits for completion of all Callable s corresponding to the Future s given. If the current thread is interrupted, each of the Callable s gets cancelled and interrupted. Also in that case, this method waits until all callables have finished. The 'interrupted'

(Future[] futures)

Source from the content-addressed store, hash-verified

126 * as required for preview in an ImageJ ExtendedPlugInFilter.
127 */
128 public static void joinAll(Future[] futures) {
129 boolean interrupted = false;
130 for (int i=0; i<futures.length; i++) {
131 Future f = futures[i];
132 try {
133 f.get();
134 } catch (InterruptedException e) {
135 interrupted = true;
136 for (int j=i; j<futures.length; j++)
137 futures[j].cancel(true);
138 i--; //we still have to wait for completion of this one
139 } catch (CancellationException e) { //cancellation is allowed, e.g. during preview
140 } catch (Exception eOther) {
141 ij.IJ.log("Error in thread called by "+Thread.currentThread().getName()+":\n"+eOther);
142 }
143 }
144 if (interrupted) {
145 Thread.currentThread().interrupt();
146 threadPoolExecutor.purge();
147 }
148 }
149}

Callers 2

doFilteringMethod · 0.95
startAndJoinMethod · 0.95

Calls 4

getNameMethod · 0.65
getMethod · 0.45
cancelMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected