/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ private Object readResolve() throws ObjectStreamException { try { IgniteBiTuple<GridKernalContext, String> t = stash.get(); return t.get1().dataStructures().countDownLatch(t.get2(), null, 0, false, false); } catch (IgniteCheckedException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** {@inheritDoc} */ @Nullable @Override public IgniteCountDownLatch countDownLatch(String name, int cnt, boolean autoDel, boolean create) { guard(); try { checkClusterState(); return ctx.dataStructures().countDownLatch(name, null, cnt, autoDel, create); } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { unguard(); } }
/** * @param latchName Latch name. * @throws Exception If failed. */ private void removeLatch(String latchName) throws Exception { IgniteCountDownLatch latch = grid(RND.nextInt(NODES_CNT)).countDownLatch(latchName, 10, false, true); assert latch != null; if (latch.count() > 0) latch.countDownAll(); // Remove latch on random node. IgniteCountDownLatch latch0 = grid(RND.nextInt(NODES_CNT)).countDownLatch(latchName, 0, false, false); assertNotNull(latch0); latch0.close(); // Ensure latch is removed on all nodes. for (Ignite g : G.allGrids()) assertNull(((IgniteKernal)g).context().dataStructures().countDownLatch(latchName, null, 10, true, false)); checkRemovedLatch(latch); }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ @SuppressWarnings({"ConstantConditions"}) private Object readResolve() throws ObjectStreamException { try { IgniteBiTuple<GridKernalContext, String> t = stash.get(); return t.get1().dataStructures().countDownLatch(t.get2(), null, 0, false, false); } catch (IgniteCheckedException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** {@inheritDoc} */ @Nullable @Override public IgniteCountDownLatch countDownLatch(String name, int cnt, boolean autoDel, boolean create) { guard(); try { checkClusterState(); return ctx.dataStructures().countDownLatch(name, null, cnt, autoDel, create); } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { unguard(); } }