Package java.util.concurrent

Examples of java.util.concurrent.ScheduledThreadPoolExecutor.shutdown()


            return srcPaths;
        } catch (IOException e) {
            e.printStackTrace();
            return srcPaths;
        } finally {
            executor.shutdown();
        }
    }

    private static final class ConstantFutureFile implements Future<File> {
        private final File file;
View Full Code Here


    try {
      futures = executor.invokeAll(callables, timeout, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
      // Swallow the exception here, because we can return partial results
    }
    executor.shutdown();
   
    // Initialize metadatas list with nulls
    // This is used to later indicate if we didn't get a response from a DN
    List<HdfsBlocksMetadata> metadatas = new ArrayList<HdfsBlocksMetadata>();
    for (int i = 0; i < futures.size(); i++) {
View Full Code Here

      futures = executor.invokeAll(callables, timeoutMs,
          TimeUnit.MILLISECONDS);
    } catch (InterruptedException e) {
      // Swallow the exception here, because we can return partial results
    }
    executor.shutdown();
   
    Map<DatanodeInfo, HdfsBlocksMetadata> metadatas =
        Maps.newHashMapWithExpectedSize(datanodeBlocks.size());
    // Fill in metadatas with results from DN RPCs, where possible
    for (int i = 0; i < futures.size(); i++) {
View Full Code Here

            sr.unregister();

            eventAdmin.stop();

            executor.shutdown();
            scheduledExecutor.shutdown();
        }
    }

    @Test
    public void testWildcard() throws Exception
View Full Code Here

            sr.unregister();

            eventAdmin.stop();

            executor.shutdown();
            scheduledExecutor.shutdown();
        }
    }

    @Test
    public void testRootWildcard() throws Exception
View Full Code Here

            sr.unregister();

            eventAdmin.stop();

            executor.shutdown();
            scheduledExecutor.shutdown();
        }
    }
}
View Full Code Here

    // Launch async processing using a dedicated thread
    ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
    executor.execute(new RequestProcessor(aCtx));
    // Never forget to close the executor in order to release all thread
    // objects link in memory...
    executor.shutdown();
    System.out.println("Sample02AsyncServlet::EndOfDoGet");
  }

}
View Full Code Here

      long startTime = System.currentTimeMillis();
      LOG.debug("sleeping");
      while (System.currentTimeMillis() < startTime + experimentDurationS * 1000) {
        Thread.sleep(100);
      }
      taskLauncher.shutdown();
    }
    catch (Exception e) {
      LOG.error("Fatal exception", e);
    }
  }
View Full Code Here

        }

        assertThat(completed, Matchers.greaterThan(0));
        assertThat(failed, Matchers.greaterThan(0));

        scheduler.shutdown();
    }

    @Test
    public void testConcurrentAccessToWriteAndOnFail() throws Exception
    {
View Full Code Here

    try {
      futures = executor.invokeAll(callables, timeout, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
      // Swallow the exception here, because we can return partial results
    }
    executor.shutdown();
   
    // Initialize metadatas list with nulls
    // This is used to later indicate if we didn't get a response from a DN
    List<HdfsBlocksMetadata> metadatas = new ArrayList<HdfsBlocksMetadata>();
    for (int i = 0; i < futures.size(); i++) {
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.