Java Thread Future submitTasks(ExecutorCompletionService ecs, Iterable> tasks)

Here you can find the source of submitTasks(ExecutorCompletionService ecs, Iterable> tasks)

Description

submit Tasks

License

Apache License

Declaration

public static <V> List<Future<V>> submitTasks(ExecutorCompletionService<V> ecs, Iterable<Callable<V>> tasks) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.LinkedList;
import java.util.List;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorCompletionService;

import java.util.concurrent.Future;

public class Main {
    public static <V> List<Future<V>> submitTasks(ExecutorCompletionService<V> ecs, Iterable<Callable<V>> tasks) {
        List<Future<V>> futures = new LinkedList<Future<V>>();
        if (tasks != null) {
            for (Callable<V> callable : tasks) {
                futures.add(ecs.submit(callable));
            }//from  w  w w  .  j a va 2  s .  c o m
        }
        return futures;
    }
}

Related

  1. runInNewThread(String threadName, Runnable target)
  2. sequence(List> futures)
  3. sequence(List> futures)
  4. sequence(List> futures)
  5. sequence(List> futures)
  6. sumFutures(List> futures)
  7. transferResult(final CompletionStage source, final CompletableFuture target)
  8. transferResult(final CompletionStage source, final CompletableFuture target)
  9. unwrap(Throwable throwable, Class throwableA)