/** {@inheritDoc} */ @Override public <T> IgniteFuture<T> invokeAsync( K key, EntryProcessor<K, V, T> processor, Object... args) { return compute.callAsync(new InvokeTask<>(cacheName, isAsync, key, processor, args)); }
/** {@inheritDoc} */ @Override public <T> IgniteFuture<T> invokeAsync(K key, CacheEntryProcessor<K, V, T> processor, Object... args) { return compute.callAsync(new InvokeTask<>(cacheName, isAsync, key, processor, args)); }
/** {@inheritDoc} */ @Override public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys, EntryProcessor<K, V, T> processor, Object... args) { return compute.callAsync(new InvokeAllTask<>(cacheName, isAsync, keys, processor, args)); }
/** {@inheritDoc} */ @Override public IgniteFuture<Boolean> putIfAbsentAsync(K key, V val) { return compute.callAsync(new PutIfAbsentTask<>(cacheName, isAsync, key, val)); }
/** {@inheritDoc} */ @Override public IgniteFuture<Boolean> removeAsync(K key, V oldVal) { return compute.callAsync(new RemoveIfExistsTask<>(cacheName, isAsync, key, oldVal)); }
/** {@inheritDoc} */ @Override public IgniteFuture<Void> removeAllAsync() { return compute.callAsync(new RemoveAllTask<K, V>(cacheName, isAsync)); }
/** {@inheritDoc} */ @Override public IgniteFuture<CacheEntry<K, V>> getEntryAsync(K key) { return compute.callAsync(new GetEntryTask<K, V>(cacheName, isAsync, key)); }
/** {@inheritDoc} */ @Override public IgniteFuture<Boolean> replaceAsync(K key, V oldVal, V newVal) { return compute.callAsync(new ReplaceIfExistsTask<>(cacheName, isAsync, key, oldVal, newVal)); }
/** {@inheritDoc} */ @Override public IgniteFuture<V> getAndReplaceAsync(K key, V val) { return compute.callAsync(new GetAndReplaceTask<>(cacheName, isAsync, key, val)); }
/** {@inheritDoc} */ @Override public IgniteFuture<V> getAsync(K key) { return compute.callAsync(new GetTask<K, V>(cacheName, isAsync, key)); }
/** {@inheritDoc} */ @Override public IgniteFuture<Map<K, V>> getAllOutTxAsync(Set<? extends K> keys) { return compute.callAsync(new GetAllOutTxTask<K, V>(cacheName, isAsync, keys)); }
/** {@inheritDoc} */ @Override public IgniteFuture<Boolean> containsKeysAsync(Set<? extends K> keys) { return compute.callAsync(new ContainsKeysTask<>(cacheName, isAsync, keys)); }
/** {@inheritDoc} */ @Override public IgniteFuture<V> getAndPutAsync(K key, V val) { return compute.callAsync(new GetAndPutTask<>(cacheName, isAsync, key, val)); }
/** {@inheritDoc} */ @Override public IgniteFuture<Boolean> replaceAsync(K key, V val) { return compute.callAsync(new ReplaceTask<>(cacheName, isAsync, key, val)); }
@Override public IgniteFuture<?> applyx(ClusterGroup prj) { return compute(prj).callAsync(new TestCallable()); } });
@Override public IgniteFuture<?> applyx(ClusterGroup prj) { return compute(prj).callAsync( Arrays.asList(new TestCallable(), new TestCallable()), new IgniteReducer<Void, Object>() { @Override public boolean collect(@Nullable Void aVoid) { return true; } @Override public Object reduce() { return null; } }); } });
@Override public void test(Factory factory, Ignite ignite) throws Exception { Collection<EchoCallable> jobs = new ArrayList<>(MAX_JOB_COUNT); for (int i = 0; i < MAX_JOB_COUNT; ++i) { EchoCallable job = (EchoCallable)factory.create(); job.setArg(value(i - 1)); jobs.add(job); } IgniteFuture<Collection<Object>> fut = ignite.compute().callAsync(jobs); checkResultsClassCount(MAX_JOB_COUNT - 1, fut.get(), value(0).getClass()); assertCollectionsEquals("Results value mismatch", createGoldenResults(), fut.get()); } });
/** * @param cnt Counter. * @throws Exception If failed. */ private void forkjoin2(AtomicInteger cnt) throws Exception { Collection<IgniteCallable<String>> jobs = F.asList(calJob); IgniteFuture<Object> fut = compute(prj).callAsync(jobs, rdc); waitForExecution(fut); cnt.set(0); compute(prj).call(jobs, rdc); waitForValue(cnt, jobs.size()); }
/** * @param cnt Counter. * @throws Exception If failed. */ private void call2(AtomicInteger cnt) throws Exception { Collection<IgniteCallable<String>> jobs = F.asList(calJob); IgniteFuture<Collection<String>> fut = compute(prj).callAsync(jobs); waitForExecution(fut); cnt.set(0); compute(prj).call(jobs); waitForValue(cnt, jobs.size()); }
/** * Starts computation job. * * @param idx Grid index on which computation job should start. * @param restartIdx The index of the node to be restarted. * @param workersCntr The current number of computation threads. */ private void startComputation(int idx, AtomicInteger restartIdx, AtomicInteger workersCntr) { Ignite ignite = grid(idx); ClusterGroup cg = ignite.cluster().forLocal(); ignite.compute(cg).callAsync(new BinaryObjectAdder(startLatch, idx, updatesQueue, restartIdx, workersCntr)); }