jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
changeset 44926 32eeee1c0abd
parent 44846 b3f9f5bf40b2
parent 44589 64d9270bd24c
child 45184 d577bc42a1f0
equal deleted inserted replaced
44925:3341e002c5e9 44926:32eeee1c0abd
  2352         this.mode = m;
  2352         this.mode = m;
  2353         this.ctl = c;
  2353         this.ctl = c;
  2354         checkPermission();
  2354         checkPermission();
  2355     }
  2355     }
  2356 
  2356 
  2357     private Object newInstanceFromSystemProperty(String property)
  2357     private static Object newInstanceFromSystemProperty(String property)
  2358         throws ReflectiveOperationException {
  2358         throws ReflectiveOperationException {
  2359         String className = System.getProperty(property);
  2359         String className = System.getProperty(property);
  2360         return (className == null)
  2360         return (className == null)
  2361             ? null
  2361             ? null
  2362             : ClassLoader.getSystemClassLoader().loadClass(className)
  2362             : ClassLoader.getSystemClassLoader().loadClass(className)
  2522     /**
  2522     /**
  2523      * @throws NullPointerException if the task is null
  2523      * @throws NullPointerException if the task is null
  2524      * @throws RejectedExecutionException if the task cannot be
  2524      * @throws RejectedExecutionException if the task cannot be
  2525      *         scheduled for execution
  2525      *         scheduled for execution
  2526      */
  2526      */
       
  2527     @SuppressWarnings("unchecked")
  2527     public ForkJoinTask<?> submit(Runnable task) {
  2528     public ForkJoinTask<?> submit(Runnable task) {
  2528         if (task == null)
  2529         if (task == null)
  2529             throw new NullPointerException();
  2530             throw new NullPointerException();
  2530         ForkJoinTask<?> job;
  2531         return externalSubmit((task instanceof ForkJoinTask<?>)
  2531         if (task instanceof ForkJoinTask<?>) // avoid re-wrap
  2532             ? (ForkJoinTask<Void>) task // avoid re-wrap
  2532             job = (ForkJoinTask<?>) task;
  2533             : new ForkJoinTask.AdaptedRunnableAction(task));
  2533         else
       
  2534             job = new ForkJoinTask.AdaptedRunnableAction(task);
       
  2535         return externalSubmit(job);
       
  2536     }
  2534     }
  2537 
  2535 
  2538     /**
  2536     /**
  2539      * @throws NullPointerException       {@inheritDoc}
  2537      * @throws NullPointerException       {@inheritDoc}
  2540      * @throws RejectedExecutionException {@inheritDoc}
  2538      * @throws RejectedExecutionException {@inheritDoc}