Java Code Examples for org.apache.hadoop.util.AsyncDiskService#shutdown()
The following examples show how to use
org.apache.hadoop.util.AsyncDiskService#shutdown() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestAsyncDiskService.java From hadoop with Apache License 2.0 | 5 votes |
/** * This test creates some ExampleTasks and runs them. */ @Test public void testAsyncDiskService() throws Throwable { String[] vols = new String[]{"/0", "/1"}; AsyncDiskService service = new AsyncDiskService(vols); int total = 100; for (int i = 0; i < total; i++) { service.execute(vols[i%2], new ExampleTask()); } Exception e = null; try { service.execute("no_such_volume", new ExampleTask()); } catch (RuntimeException ex) { e = ex; } assertNotNull("Executing a task on a non-existing volume should throw an " + "Exception.", e); service.shutdown(); if (!service.awaitTermination(5000)) { fail("AsyncDiskService didn't shutdown in 5 seconds."); } assertEquals(total, count); }
Example 2
Source File: TestAsyncDiskService.java From big-c with Apache License 2.0 | 5 votes |
/** * This test creates some ExampleTasks and runs them. */ @Test public void testAsyncDiskService() throws Throwable { String[] vols = new String[]{"/0", "/1"}; AsyncDiskService service = new AsyncDiskService(vols); int total = 100; for (int i = 0; i < total; i++) { service.execute(vols[i%2], new ExampleTask()); } Exception e = null; try { service.execute("no_such_volume", new ExampleTask()); } catch (RuntimeException ex) { e = ex; } assertNotNull("Executing a task on a non-existing volume should throw an " + "Exception.", e); service.shutdown(); if (!service.awaitTermination(5000)) { fail("AsyncDiskService didn't shutdown in 5 seconds."); } assertEquals(total, count); }
Example 3
Source File: TestAsyncDiskService.java From RDFS with Apache License 2.0 | 5 votes |
/** * This test creates some ExampleTasks and runs them. */ public void testAsyncDiskService() throws Throwable { String[] vols = new String[]{"/0", "/1"}; AsyncDiskService service = new AsyncDiskService(vols); int total = 100; for (int i = 0; i < total; i++) { service.execute(vols[i%2], new ExampleTask()); } Exception e = null; try { service.execute("no_such_volume", new ExampleTask()); } catch (RuntimeException ex) { e = ex; } assertNotNull("Executing a task on a non-existing volume should throw an " + "Exception.", e); service.shutdown(); if (!service.awaitTermination(5000)) { fail("AsyncDiskService didn't shutdown in 5 seconds."); } assertEquals(total, count); }