/** {@inheritDoc} */ @Override public void run() { List<Grid> clientGrids = runGrid(); assert clientGrids.size() == clientNodes; int threadsCnt = clientNodes * threadsPerClient; Executor e = Executors.newFixedThreadPool(threadsCnt); for (Grid grid : clientGrids) { for (int j = 0; j < threadsPerClient; j++) e.execute(new GridJobLoadTestSubmitter(grid, taskParams, cancelRate, submitDelay)); } }
/** * Schedules runnable task for execution. * * @param w Runnable task. * @throws GridException Thrown if any exception occurred. */ @SuppressWarnings({"CatchGenericClass", "ProhibitedExceptionThrown"}) public void execute(final GridWorker w) throws GridException { workers.add(w); try { exec.execute( new Runnable() { @Override public void run() { try { w.run(); } finally { workers.remove(w); } } }); } catch (RejectedExecutionException e) { workers.remove(w); throw new GridComputeExecutionRejectedException( "Failed to execute worker due to execution rejection.", e); } catch (RuntimeException e) { workers.remove(w); throw new GridException("Failed to execute worker due to runtime exception.", e); } catch (Error e) { workers.remove(w); throw e; } }