/** * @param cacheName Cache name. * @param c Closure to execute. * @return Execution future. */ private GridFuture<GridRestResponse> broadcast(String cacheName, Callable<Object> c) { GridFuture<Collection<Object>> fut = ctx.grid().forCache(cacheName). compute().withNoFailover().broadcast(c); return fut.chain(new C1<GridFuture<Collection<Object>>, GridRestResponse>() { @Override public GridRestResponse apply(GridFuture<Collection<Object>> fut) { try { fut.get(); return new GridRestResponse(); } catch (GridException e) { throw new GridClosureException(e); } } }); }
/** {@inheritDoc} */ @Override public void isolated(boolean isolated) throws GridException { if (isolated()) return; GridNode node = F.first(ctx.grid().forCache(cacheName).nodes()); if (node == null) throw new GridException("Failed to get node for cache: " + cacheName); GridCacheAttributes a = U.cacheAttributes(node, cacheName); assert a != null; updater = a.atomicityMode() == GridCacheAtomicityMode.ATOMIC ? GridDataLoadCacheUpdaters.<K, V>batched() : GridDataLoadCacheUpdaters.<K, V>groupLocked(); }
GridNode node = F.first(ctx.grid().forCache(cacheName).nodes());