/** * Waits for N threads to enter the {@link #synchronize()} method, then * returns. * * @return * returns normally if N threads successfully synchronized. * @throws InterruptedException * if any of the threads that were synchronizing get interrupted, * or if the {@link #abort(Throwable)} is called. */ public synchronized void synchronize() throws InterruptedException { check(n); try { onCriteriaMet(); } catch (Error e) { abort(e); throw e; } catch (RuntimeException e) { abort(e); throw e; } check(n*2); }
/** * Waits for N threads to enter the {@link #synchronize()} method, then * returns. * * @return * returns normally if N threads successfully synchronized. * @throws InterruptedException * if any of the threads that were synchronizing get interrupted, * or if the {@link #abort(Throwable)} is called. */ public synchronized void synchronize() throws InterruptedException { check(n); try { onCriteriaMet(); } catch (Error e) { abort(e); throw e; } catch (RuntimeException e) { abort(e); throw e; } check(n*2); }