Examples of invokeAny()


Examples of java.util.concurrent.ExecutorService.invokeAny()

    String result;
    try {
      // Send the list of tasks to the executor and waits for the result of the first task
      // that finish without throw and Exception. If all the tasks throw and Exception, the
      // method throws and ExecutionException.
      result = executor.invokeAny(taskList);
      System.out.printf("Main: Result: %s\n",result);
    } catch (InterruptedException e) {
      e.printStackTrace();
    } catch (ExecutionException e) {
      e.printStackTrace();
View Full Code Here

Examples of java.util.concurrent.ExecutorService.invokeAny()

         });
      }
      try
      {
         // we wait 5 seconds to get the first matching hardware address. After that, we give up and return null
         byte[] address = executor.invokeAny(tasks, 5, TimeUnit.SECONDS);
         return address;
      }
      catch (Exception e)
      {
         return null;
View Full Code Here

Examples of java.util.concurrent.ExecutorService.invokeAny()

      ExecutionException, TimeoutException {
    ExecutorService service = delegate.get();
    if (service != null) {
      // since the tasks are either executed or cancelled, there is no
      // need to track them
      return service.invokeAny(tasks, timeout, unit);
    }
    throw new RejectedExecutionException(
        "Execution service is terminated. No more tasks can be executed.");
  }
View Full Code Here

Examples of java.util.concurrent.ExecutorService.invokeAny()

      throws InterruptedException, ExecutionException {
    ExecutorService service = delegate.get();
    if (service != null) {
      // since the tasks are either executed or cancelled, there is no
      // need to track them
      return service.invokeAny(tasks);
    }
    throw new RejectedExecutionException(
        "Execution service is terminated. No more tasks can be executed.");
  }
View Full Code Here

Examples of java.util.concurrent.ExecutorService.invokeAny()

         });
      }
      try
      {
         // we wait 5 seconds to get the first matching hardware address. After that, we give up and return null
         byte[] address = executor.invokeAny(tasks, 5, TimeUnit.SECONDS);
         return address;
      }
      catch (Exception e)
      {
         return null;
View Full Code Here

Examples of java.util.concurrent.ExecutorService.invokeAny()

         });
      }
      try
      {
         // we wait 5 seconds to get the first matching hardware address. After that, we give up and return null
         byte[] address = executor.invokeAny(tasks, 5, TimeUnit.SECONDS);
         return address;
      }
      catch (Exception e)
      {
         return null;
View Full Code Here

Examples of java.util.concurrent.ExecutorService.invokeAny()

                                         ExecutionException,
                                         TimeoutException {
        ExecutorService service = delegate.get();
        if ( service != null ) {
            // since the tasks are either executed or cancelled, there is no need to track them
            return service.invokeAny( tasks,
                                      timeout,
                                      unit );
        }
        throw new RejectedExecutionException( "Execution service is terminated. No more tasks can be executed." );
    }
View Full Code Here

Examples of java.util.concurrent.ExecutorService.invokeAny()

    public <T> T invokeAny(Collection<Callable<T>> tasks) throws InterruptedException,
                                                         ExecutionException {
        ExecutorService service = delegate.get();
        if ( service != null ) {
            // since the tasks are either executed or cancelled, there is no need to track them
            return service.invokeAny( tasks );
        }
        throw new RejectedExecutionException( "Execution service is terminated. No more tasks can be executed." );
    }

    /**
 
View Full Code Here

Examples of java.util.concurrent.ExecutorService.invokeAny()

            ExecutionException, TimeoutException {
        ExecutorService service = delegate.get();
        if (service != null) {
            // since the tasks are either executed or cancelled, there is no
            // need to track them
            return service.invokeAny(tasks, timeout, unit);
        }
        throw new RejectedExecutionException(
                "Execution service is terminated. No more tasks can be executed.");
    }
View Full Code Here

Examples of java.util.concurrent.ExecutorService.invokeAny()

            throws InterruptedException, ExecutionException {
        ExecutorService service = delegate.get();
        if (service != null) {
            // since the tasks are either executed or cancelled, there is no
            // need to track them
            return service.invokeAny(tasks);
        }
        throw new RejectedExecutionException(
                "Execution service is terminated. No more tasks can be executed.");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.