@Override public void close() throws IOException { repo.close(); }
@Override public void close() throws IOException { repo.close(); }
@Override public void lifeCycleStopped(LifeCycle event) { logger.info("Waited {} ms to drain requests before closing the repo and exiting. " + "This wait time can be adjusted with the {} config property.", gracefulShutdown, Config.JETTY_GRACEFUL_SHUTDOWN); try { repo.close(); logger.info("Successfully closed the repo."); } catch (IOException e) { logger.warn("Failed to properly close repo", e); } } }
@Override public void lifeCycleStopped(LifeCycle event) { logger.info("Waited {} ms to drain requests before closing the repo and exiting. " + "This wait time can be adjusted with the {} config property.", gracefulShutdown, Config.JETTY_GRACEFUL_SHUTDOWN); try { repo.close(); logger.info("Successfully closed the repo."); } catch (IOException e) { logger.warn("Failed to properly close repo", e); } } }
} finally { try { innerRepo.close(); } catch (IOException e) { e.printStackTrace();
@Test public void testWriteCloseRead() throws Exception { try { repo.register("sub1", null).register("sc1"); repo.register("sub2", null).register("sc2"); repo.register("sub2", null).register("sc3"); } finally { repo.close(); } // Calling close() and createRepository() is like bouncing the repo, to ensure its state persists. repo = createRepository(); try { Subject s1 = repo.lookup("sub1"); Assert.assertNotNull(s1); Subject s2 = repo.lookup("sub2"); Assert.assertNotNull(s2); SchemaEntry e1 = s1.lookupBySchema("sc1"); Assert.assertNotNull(e1); Assert.assertEquals("sc1", e1.getSchema()); SchemaEntry e2 = s2.lookupBySchema("sc2"); Assert.assertNotNull(e2); Assert.assertEquals("sc2", e2.getSchema()); SchemaEntry e3 = s2.lookupBySchema("sc3"); Assert.assertNotNull(e3); Assert.assertEquals("sc3", e3.getSchema()); } finally { repo.close(); } }