Code example for ThreadFactory

Methods: newThread

0
  } 
 
  @Override 
  public void execute(Runnable task)
  { 
    Thread thread = _threadFactory.newThread(task);
    thread.start();
  } 
 
  /** 
   * Executes the callable in a separate thread and return the future to get the result. Note 
   * that this implementation is not efficient and should be used very carefully. 
   * 
   * @param callable 
   * @return the future to get the result. 
   */ 
  public static <V> Future<V> execute(Callable<V> callable)
  { 
    FutureTask<V> futureTask = new FutureTask<V>(callable);
 
    new Thread(futureTask).start();