/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { return execName == null ? prj.compute() : prj.compute().withExecutor(execName); }
/** * @throws Exception If fails. */ @Test public void testInvalidCustomExecutor() throws Exception { grid(0).compute().withExecutor("invalid").broadcast(new IgniteRunnable() { @Override public void run() { assertTrue(Thread.currentThread().getName().contains("pub")); } }); }
IgniteCompute comp = grid(0).compute().withExecutor(EXEC_NAME0);
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { return execName == null ? prj.compute() : prj.compute().withExecutor(execName); }
@Override public void run() { System.out.println("Ignite Outer task!"); ignite.compute().withExecutor("myCustomThreadPool").run(new InternalTask()); }
@Override public void run() { final MapReduceJob<Serializable, Serializable> mJob = ObjectContainer.get(jobMeta.getId()); final List<Serializable> items = mJob.mapper().map(); if (items != null) { // execute final Collection<IgniteCallable<Serializable>> jobs = new ArrayList<>(); items.forEach(item -> jobs.add(() -> ObjectContainer.<MapReduceJob<Serializable, Serializable>>get(jobMeta.getId()).executor().execute(item))); final Collection<Serializable> results = igniteRemote.compute(select(ignite)) .withExecutor(jobMeta.getId()) .call(jobs); mJob.reducer().reduce(new ArrayList<>(results)); } } });
@Override public void run() { final Streamer<Serializable> streamer = ObjectContainer.<StreamingJob<Serializable>>get(jobMeta.getId()).streamer(); final int concurrency = igniteRemote.cluster().nodes().size() * jobMeta.getThreads(); LOGGER.info("Cluster concurrency : {}", concurrency); final Semaphore cycle = new Semaphore(concurrency); final List<IgniteFuture> futures = new ArrayList<>(); final IgniteCompute igniteCompute = igniteRemote.compute(select(ignite)).withExecutor(jobMeta.getId()); while (streamer.hasNext()) { // execute final Serializable next = streamer.next(); try { cycle.acquire(); final IgniteFuture<Void> igniteFuture = igniteCompute .runAsync(() -> { ObjectContainer.<StreamingJob<Serializable>>get(jobMeta.getId()).executor().execute(next); }); futures.add(igniteFuture); igniteFuture.listen((future) -> { cycle.release(); }); } catch (InterruptedException e) { } } futures.forEach(IgniteFuture::get); } });
@Override public void run() { final List<Serializable> items = ObjectContainer.<DistributedJob<Serializable>>get(jobMeta.getId()).slicer().slice(); if (items != null) { // Execute Collection<IgniteRunnable> jobs = new ArrayList<>(); items.forEach(item -> { jobs.add(() -> { ObjectContainer.<DistributedJob<Serializable>>get(jobMeta.getId()).executor().execute(item); }); }); igniteRemote.compute(select(ignite)) .withExecutor(jobMeta.getId()) .run(jobs); } } });
@Override public void handle(JobMeta jobMeta, Ignite ignite) { // map ignite.compute(select(ignite)) .withExecutor(jobMeta.getId()) .run(new IgniteRunnable() { @IgniteInstanceResource private Ignite igniteRemote; @Override public void run() { final MapReduceJob<Serializable, Serializable> mJob = ObjectContainer.get(jobMeta.getId()); final List<Serializable> items = mJob.mapper().map(); if (items != null) { // execute final Collection<IgniteCallable<Serializable>> jobs = new ArrayList<>(); items.forEach(item -> jobs.add(() -> ObjectContainer.<MapReduceJob<Serializable, Serializable>>get(jobMeta.getId()).executor().execute(item))); final Collection<Serializable> results = igniteRemote.compute(select(ignite)) .withExecutor(jobMeta.getId()) .call(jobs); mJob.reducer().reduce(new ArrayList<>(results)); } } }); }
@Override public void handle(final JobMeta jobMeta, Ignite ignite) { ignite.compute(select(ignite)) .withExecutor(jobMeta.getId()) .run(new IgniteRunnable() { @IgniteInstanceResource private Ignite igniteRemote; @Override public void run() { final List<Serializable> items = ObjectContainer.<DistributedJob<Serializable>>get(jobMeta.getId()).slicer().slice(); if (items != null) { // Execute Collection<IgniteRunnable> jobs = new ArrayList<>(); items.forEach(item -> { jobs.add(() -> { ObjectContainer.<DistributedJob<Serializable>>get(jobMeta.getId()).executor().execute(item); }); }); igniteRemote.compute(select(ignite)) .withExecutor(jobMeta.getId()) .run(jobs); } } }); }
@Override public void handle(JobMeta jobMeta, Ignite ignite) { ignite.compute(select(ignite)) .withExecutor(jobMeta.getId()) .run(() -> { ObjectContainer.<SimpleJob>get(jobMeta.getId()).executor().execute(); }); }
@Override public void handle(JobMeta jobMeta, Ignite ignite) { ignite.compute(select(ignite)) .withExecutor(jobMeta.getId()) .run(new IgniteRunnable() {