/** * Joins given collection of runnables. * * @param ws Collection of workers to join. * @param log The logger to possible exceptions. * @return {@code true} if none of the worker have been interrupted, * {@code false} if at least one was interrupted. */ public static boolean join(Iterable<? extends GridWorker> ws, IgniteLogger log) { boolean retval = true; if (ws != null) for (GridWorker w : ws) if (!join(w, log)) retval = false; return retval; }
/** * Waits for completion of a given thread. If thread is {@code null} then * this method returns immediately returning {@code true} * * @param t Thread to join. * @param log Logger for logging errors. * @return {@code true} if thread has finished, {@code false} otherwise. */ public static boolean join(@Nullable Thread t, @Nullable IgniteLogger log) { return join(t, log, 0); }
/** * Waits for completion of a given threads. If thread is {@code null} then * this method returns immediately returning {@code true} * * @param workers Thread to join. * @param log Logger for logging errors. * @return {@code true} if thread has finished, {@code false} otherwise. */ public static boolean joinThreads(Iterable<? extends Thread> workers, @Nullable IgniteLogger log) { boolean retval = true; if (workers != null) for (Thread worker : workers) if (!join(worker, log)) retval = false; return retval; }
/** {@inheritDoc} */ @Override public void spiStop() throws IgniteSpiException { if (timeoutWrk != null) { IgniteUtils.interrupt(timeoutWrk); IgniteUtils.join(timeoutWrk, log); } unregisterMBean(); // Ack ok stop. if (log.isDebugEnabled()) log.debug(stopInfo()); }
/** * Joins given collection of runnables. * * @param ws Collection of workers to join. * @param log The logger to possible exceptions. * @return {@code true} if none of the worker have been interrupted, * {@code false} if at least one was interrupted. */ public static boolean join(Iterable<? extends GridWorker> ws, IgniteLogger log) { boolean retval = true; if (ws != null) for (GridWorker w : ws) if (!join(w, log)) retval = false; return retval; }
/** * Waits for completion of a given thread. If thread is {@code null} then * this method returns immediately returning {@code true} * * @param t Thread to join. * @param log Logger for logging errors. * @return {@code true} if thread has finished, {@code false} otherwise. */ public static boolean join(@Nullable Thread t, @Nullable IgniteLogger log) { return join(t, log, 0); }
/** * Waits for completion of a given threads. If thread is {@code null} then * this method returns immediately returning {@code true} * * @param workers Thread to join. * @param log Logger for logging errors. * @return {@code true} if thread has finished, {@code false} otherwise. */ public static boolean joinThreads(Iterable<? extends Thread> workers, @Nullable IgniteLogger log) { boolean retval = true; if (workers != null) for (Thread worker : workers) if (!join(worker, log)) retval = false; return retval; }
/** {@inheritDoc} */ @Override public void spiStop() throws IgniteSpiException { if (timeoutWrk != null) { IgniteUtils.interrupt(timeoutWrk); IgniteUtils.join(timeoutWrk, log); } unregisterMBean(); // Ack ok stop. if (log.isDebugEnabled()) log.debug(stopInfo()); }