/** {@inheritDoc} */ @Override public void listen(IgniteInClosure<? super IgniteInternalFuture<T>> lsnr) { assert lsnr != null; lsnr.apply(this); }
@Override public void apply(IgniteInternalFuture fut0) { lsnr.apply(ComputeConvertingFuture.this); } });
@Override public void run() { lsnr.apply(fut); } });
@Override public Void call() throws Exception { call.apply(idx); return null; } });
/** {@inheritDoc} */ @Override public boolean activate() { activated = true; if (onActivate != null) onActivate.apply(this); return true; }
/** {@inheritDoc} */ @Override public void onLocalNodeInitialized(ClusterNode locNode) { for (IgniteInClosure<ClusterNode> lsnr : locNodeInitLsnrs) lsnr.apply(locNode); if (locNode instanceof IgniteClusterNode) { final IgniteClusterNode node = (IgniteClusterNode)locNode; if (consistentId != null) node.setConsistentId(consistentId); } }
/** * @param evts Events. */ private void onEvents(Iterable<CacheEntryEvent<?, ?>> evts) { clsr.apply(evts); }
/** * Executes given closure for every item in circular buffer. * * @param c Closure to execute. */ public void forEach(IgniteInClosure<T> c) { for (Item<T> t : arr) { T item = t.item(); if (item == null) break; c.apply(item); } }
/** * @param c Cache context closure. */ void forAllCaches(final IgniteInClosure<GridCacheContext> c) { for (Integer cacheId : ctxMap.keySet()) { ctxMap.computeIfPresent(cacheId, (cacheId1, ctx) -> { c.apply(ctx); return ctx; } ); } }
/** * */ public void onConnected() { synchronized (this) { assert reserved : this; assert !connected : this; connected = true; if (handshakeReq != null) { IgniteInClosure<Boolean> c = handshakeReq.get2(); assert c != null; c.apply(false); handshakeReq = null; } notifyAll(); } }
/** * Calls given {@code side-effect only} closure over the each element of the provided * collection. * * @param c Collection to call closure over. * @param f Side-effect only closure to call over the collection. * @param p Optional set of predicates. Only if collection element evaluates * to {@code true} for given predicates the closure will be applied to it. * If no predicates provided - closure will be applied to all collection * elements. * @param <X> Type of the free variable for the closure and type of the * collection elements. */ @Deprecated public static <X> void forEach(Iterable<? extends X> c, IgniteInClosure<? super X> f, @Nullable IgnitePredicate<? super X>... p) { A.notNull(c, "c", f, "f"); for (X x : c) if (isAll(x, p)) f.apply(x); }
/** * Starts the ProcessStreamGrabber. */ @Override public void run() { try { BufferedReader br = new BufferedReader(new InputStreamReader(streamToGrab)); String line; while ((line = br.readLine()) != null && !isInterrupted()) { if (line.startsWith(PID_MSG_PREFIX)) pid = line.substring(PID_MSG_PREFIX.length()); else if (printC != null) printC.apply(line); } } catch (IOException e) { U.error(log, "Caught IOException while grabbing stream", e); try { // Check if process is still alive. proc.exitValue(); if (procKilledC != null) procKilledC.apply(); } catch (IllegalThreadStateException e1) { if (!interrupted()) U.error(log, "Failed to get exit value from process.", e1); } } }
/** {@inheritDoc} */ @Override public void visit(long pageAddr, IgniteInClosure<CacheSearchRow> c) { int cnt = getCount(pageAddr); for (int i = 0; i < cnt; i++) c.apply(new CacheDataRowAdapter(getLink(pageAddr, i))); }
/** {@inheritDoc} */ @Override public void visit(long pageAddr, IgniteInClosure<CacheSearchRow> c) { int cnt = getCount(pageAddr); for (int i = 0; i < cnt; i++) c.apply(new CacheDataRowAdapter(getLink(pageAddr, i))); }
/** * Iterates over cache. * * @param cache Projection. * @param c Visitor closure. */ private void iterate(IgniteCache<Integer, Integer> cache, IgniteInClosure<Cache.Entry<Integer, Integer>> c) { for (Cache.Entry<Integer, Integer> entry : cache.localEntries()) c.apply(entry); }
/** {@inheritDoc} */ @Override public void visit(long pageAddr, IgniteInClosure<CacheSearchRow> c) { int cnt = getCount(pageAddr); for (int i = 0; i < cnt; i++) c.apply(new MvccDataRow(getLink(pageAddr, i))); }
/** {@inheritDoc} */ @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC) { if (filter != null) filter.apply(msg); super.sendMessage(node, msg, ackC); } }
/** {@inheritDoc} */ @Override public void visit(long pageAddr, IgniteInClosure<CacheSearchRow> c) { int cnt = getCount(pageAddr); for (int i = 0; i < cnt; i++) c.apply(new MvccDataRow(getLink(pageAddr, i))); }
/** * Select all data from the table and check that all records correspond to rules set by given closure. * @param clo Closure to apply to each record. */ private void assertAllPersons(IgniteInClosure<List<?>> clo) { List<List<?>> res = executeSql("SELECT * from Person"); for (List<?> p : res) clo.apply(p); }
/** * */ public void release() { SessionWriteRequest[] futs = null; synchronized (this) { ses = null; connected = false; if (handshakeReq != null) { IgniteInClosure<Boolean> c = handshakeReq.get2(); assert c != null; handshakeReq = null; c.apply(true); } else { reserved = false; notifyAll(); } if (nodeLeft && !msgReqs.isEmpty()) { futs = msgReqs.toArray(new SessionWriteRequest[msgReqs.size()]); msgReqs.clear(); } } if (futs != null) notifyOnNodeLeft(futs); }