Package ch.cmbntr.modulizer.bootstrap.util.Resources

Examples of ch.cmbntr.modulizer.bootstrap.util.Resources.Pool.aquireBlockableExec()


    return Maps.transformValues(submitCompute(items, f), ModulizerUtil.<T> futureCollector());
  }

  private static <F, T> Map<F, Future<T>> submitCompute(final Iterable<F> items, final Function<? super F, T> f) {
    final Pool pool = Resources.getPoolHandle();
    final ExecutorService exec = pool.aquireBlockableExec();
    try {
      final ImmutableMap.Builder<F, Future<T>> submits = ImmutableMap.builder();
      for (final F i : items) {
        submits.put(i, exec.submit(new Callable<T>() {
          @Override
View Full Code Here


    return Maps.transformValues(submitCompute(items, f), ModulizerUtil.<T> futureCollector());
  }

  private static <F, T> Map<F, Future<T>> submitCompute(final Iterable<F> items, final Function<? super F, T> f) {
    final Pool pool = Resources.getPoolHandle();
    final ScheduledExecutorService exec = pool.aquireBlockableExec();
    try {
      final ImmutableMap.Builder<F, Future<T>> submits = ImmutableMap.builder();
      for (final F i : items) {
        submits.put(i, exec.submit(new Callable<T>() {
          @Override
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.