SafetyNetCloseableRegistry extends
		AbstractCloseableRegistry<WrappingProxyCloseable<? extends Closeable>,
				SafetyNetCloseableRegistry.PhantomDelegatingCloseableRef> { @VisibleForTesting static boolean isReaperThreadRunning() { synchronized (REAPER_THREAD_LOCK) { return null != REAPER_THREAD && REAPER_THREAD.isAlive(); } } SafetyNetCloseableRegistry(); @Override void close();  }
@Test public void testReaperThreadSpawnAndStop() throws Exception { Assert.assertFalse(SafetyNetCloseableRegistry.isReaperThreadRunning()); try (SafetyNetCloseableRegistry ignored = new SafetyNetCloseableRegistry()) { Assert.assertTrue(SafetyNetCloseableRegistry.isReaperThreadRunning()); try (SafetyNetCloseableRegistry ignored2 = new SafetyNetCloseableRegistry()) { Assert.assertTrue(SafetyNetCloseableRegistry.isReaperThreadRunning()); } Assert.assertTrue(SafetyNetCloseableRegistry.isReaperThreadRunning()); } Assert.assertFalse(SafetyNetCloseableRegistry.isReaperThreadRunning()); }