src/main/java/com/machinezoo/pushmode/PageExecutor.java
@Override
	public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) {
		List<Callable<T>> taskList = new ArrayList<>(tasks);
		List<CompletableFuture<T>> futures = Stream.generate(CompletableFuture<T>::new)
			.limit(tasks.size())
			.collect(toList());
		Exceptions.sneak().run(() -> {
			try {
				submit(() -> {
					for (int i = 0; i < futures.size(); ++i)
						eval(taskList.get(i), futures.get(i));
				}).get(timeout, unit);
			} catch (TimeoutException e) {
				for (CompletableFuture<T> future : futures)
					future.cancel(false);
			}
		});
		return new ArrayList<>(futures);
	}
/**
	 * Blocks until all tasks complete running on this {@link PageExecutor} or timeout expires.
	 * All supplied tasks are executed as one big event in the event loop. They are not scheduled separately.
	 * If timeout is reached, this method completes without exception,
	 * but some or all of the tasks might be in cancelled state as if {@link CompletableFuture#cancel(boolean)} was called.
	 * 
	 * @param tasks
	 *            Tasks to execute on this {@link PageExecutor}.
	 * @param timeout
	 *            Timeout to wait for completion of the tasks in units specified.
	 * @param unit
	 *            Unit of the timeout.
	 * @return List of completed futures holding result or exception for every supplied task. If timeout is reached some or all of the tasks might be cancelled instead.
	 * @x.threads This method is safe to call from any thread except the thread used by this {@link PageExecutor} where it would result in a deadlock.
	 *            This method blocks, which means it shouldn't be called from within event on any {@link PageExecutor}.
	 *            The supplied tasks will run in the event loop, which means they don't need to synchronize access with other events in the same event loop.
	 */
Blocks until all tasks complete running on this  PageExecutor or timeout expires.
All supplied tasks are executed as one big event in the event loop. They are not scheduled separately.
If timeout is reached, this method completes without exception,
but some or all of the tasks might be in cancelled state as if  CompletableFuture#cancel(boolean) was called.

@param tasks
Tasks to execute on this  PageExecutor.
@param timeout
Timeout to wait for completion of the tasks in units specified.
@param unit
Unit of the timeout.
@return List of completed futures holding result or exception for every supplied task. If timeout is reached some or all of the tasks might be cancelled instead.
@x.threads This method is safe to call from any thread except the thread used by this  PageExecutor where it would result in a deadlock.
This method blocks, which means it shouldn't be called from within event on any  PageExecutor.
The supplied tasks will run in the event loop, which means they don't need to synchronize access with other events in the same event loop.
Blocks until all tasks complete running on this PageExecutor or timeout expires . All supplied tasks are executed as one big event in the event loop . They are not scheduled separately . If timeout is reached this method completes without exception but some or all of the tasks might be in cancelled state as if CompletableFuture#cancel ( boolean ) was called . @param tasks Tasks to execute on this PageExecutor . @param timeout Timeout to wait for completion of the tasks in units specified . @param unit Unit of the timeout . @return List of completed futures holding result or exception for every supplied task . If timeout is reached some or all of the tasks might be cancelled instead . @x . threads This method is safe to call from any thread except the thread used by this PageExecutor where it would result in a deadlock . This method blocks which means it shouldn ' t be called from within event on any PageExecutor . The supplied tasks will run in the event loop which means they don ' t need to synchronize access with other events in the same event loop .
@Override
	public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) {
		List<Callable<T>> taskList = new ArrayList<>(tasks);
		List<CompletableFuture<T>> futures = Stream.generate(CompletableFuture<T>::new)
			.limit(tasks.size())
			.collect(toList());
		Exceptions.sneak().run(() -> {
			try {
				submit(() -> {
					for (int i = 0; i < futures.size(); ++i)
						eval(taskList.get(i), futures.get(i));
				}).get(timeout, unit);
			} catch (TimeoutException e) {
				for (CompletableFuture<T> future : futures)
					future.cancel(false);
			}
		});
		return new ArrayList<>(futures);
	}
@ Override public < T > List < Future < T > > invokeAll ( Collection < ? extends Callable < T > > tasks , long timeout , TimeUnit unit ) { List < Callable < T > > taskList = new ArrayList < > ( tasks ) ; List < CompletableFuture < T > > futures = Stream . generate ( CompletableFuture < T > :: new ) . limit ( tasks . size ( ) ) . collect ( toList ( ) ) ; Exceptions . sneak ( ) . run ( ( ) -> { try { submit ( ( ) -> { for ( int i = 0 ; i < futures . size ( ) ; ++ i ) eval ( taskList . get ( i ) , futures . get ( i ) ) ; } ) . get ( timeout , unit ) ; } catch ( TimeoutException e ) { for ( CompletableFuture < T > future : futures ) future . cancel ( false ) ; } } ) ; return new ArrayList < > ( futures ) ; }
Blocks until all tasks complete running on this {@link PageExecutor} or timeout expires.
Blocks until all tasks complete running on this { @link PageExecutor } or timeout expires .