FileChannel extends BasicChannelSemantics { @Override public synchronized void stop() { LOG.info("Stopping FileChannel with dataDir " + Arrays.toString(dataDirs)); try { if(shutdownHookAdded && shutdownHook != null) { Runtime.getRuntime().removeShutdownHook(shutdownHook); shutdownHookAdded = false; shutdownHook = null; } } finally { close(); } super.stop(); }  @Override void configure(Context context); @Override synchronized void start(); @Override synchronized void stop();  }
@Test public void testRestart() throws Exception { List<String> in = Lists.newArrayList(); try { while(true) { in.addAll(putEvents(channel, "restart", 1, 1)); } } catch (ChannelException e) { Assert.assertEquals("Cannot acquire capacity", e.getMessage()); } channel.stop(); channel = createFileChannel(); List<String> out = takeEvents(channel, 1, Integer.MAX_VALUE); Collections.sort(in); Collections.sort(out); Assert.assertEquals(in, out); }