/** {@inheritDoc} */ @Override public void onCompletion() { assert lsnr != null; lsnr.apply(null, null); }
/** {@inheritDoc} */ @Override public void onException(Exception e) { lsnr.apply(null, e); }
/** {@inheritDoc} */ @Override public void onCreated(Iterable<CacheEntryEvent<? extends QueryTestKey, ? extends QueryTestValue>> events) throws CacheEntryListenerException { for (CacheEntryEvent<? extends QueryTestKey, ? extends QueryTestValue> e : events) clsr.apply(ignite, e); } }
@Override public Void call() throws Exception { c.apply(key, clientCache); return null; } });
/** {@inheritDoc} */ @Override public void onTimeout() { if (!fut.isDone() && finishGuard.compareAndSet(false, true)) clo.apply(null, true); }
/** {@inheritDoc} */ @Override public void loadCache(IgniteBiInClosure<Object, Object> clo, Object... args) { for (int i = 0; i < 10; i++) clo.apply(i, i); }
/** {@inheritDoc} */ @Override public void loadCache(IgniteBiInClosure<Object, Object> clo, Object... args) { for (int i = 0; i < 10; i++) clo.apply(i, i); }
/** {@inheritDoc} */ @Override public void onUpdated(Iterable<CacheEntryEvent<? extends QueryTestKey, ? extends QueryTestValue>> events) throws CacheEntryListenerException { for (CacheEntryEvent<? extends QueryTestKey, ? extends QueryTestValue> e : events) clsr.apply(ignite, e); }
/** {@inheritDoc} */ @Override public final boolean loadAll(@Nullable IgniteInternalTx tx, Collection keys, IgniteBiInClosure vis) throws IgniteCheckedException { if (store != null) { loadAllFromStore(tx, keys, vis, null); return true; } else { for (Object key : keys) vis.apply(key, null); } return false; }
@Override public Void call() throws Exception { c.apply(key, clientCache); return null; } }, "tx-thread");
/** {@inheritDoc} */ @Override public boolean evaluate(CacheEntryEvent<? extends QueryTestKey, ? extends QueryTestValue> e) throws CacheEntryListenerException { clsr.apply(ignite, e); return true; } }
@Override public void loadCache(IgniteBiInClosure clo, Object... args) { for (int i = 0; i < SIZE; i++) clo.apply(i, i); }
@Override public void apply(IgniteInternalFuture<?> fut) { if (finalTimeoutObj != null && !finalTimeoutObj.finishGuard.compareAndSet(false, true)) return; try { fut.get(); clo.apply(null, false); } catch (IgniteCheckedException e) { clo.apply(e, false); } finally { if (finalTimeoutObj != null) removeTimeoutObject(finalTimeoutObj); } } });
/** * Handles size after put. */ private void onPut() { cnt.incrementAndGet(); IgniteBiInClosure<K, V> lsnr = this.lsnr; int delta = cnt.get() - max; for (int i = 0; i < delta && cnt.get() > max; i++) { Entry<K, V> e = pollFirstEntry(); if (e == null) return; cnt.decrementAndGet(); // Listener notification. if (lsnr != null) lsnr.apply(e.getKey(), e.getValue()); } }
/** {@inheritDoc} */ @Override public void loadCache(IgniteBiInClosure<Integer, String> clo, @Nullable Object... args) { assert clo != null; assert args != null; Integer cnt = (Integer)args[0]; assert cnt != null; for (int i = 0; i < cnt; i++) clo.apply(i, "val" + i); }
/** {@inheritDoc} */ @Override public void loadCache(IgniteBiInClosure<Integer, byte[]> clo, @Nullable Object... args) throws CacheLoaderException { for (int i = 0; i < ENTRIES_CNT; i++) clo.apply(i, data); } }
/** {@inheritDoc} */ @Override public void loadCache(IgniteBiInClosure<Integer, String> f, Object... args) { for (int i = 0; i < KEYS_CNT; i++) f.apply(i, Integer.toString(i)); }
/** {@inheritDoc} */ @Override public void loadCache(IgniteBiInClosure<Object, Object> clo, Object... args) { for (Map.Entry e : map.entrySet()) clo.apply(e.getKey(), e.getValue()); }