@Test public void testShutdownHook() { // Can't really test this except to verify that no exception is thrown now or at shutdown JVMUtils.closeAtShutdown(() -> {}); }
@Test public void testUsedMemory() { // Reasonable guess assertGreaterOrEqual(JVMUtils.getUsedMemory(), 1L << 20); }
public static void main(String[] args) throws Exception { try (ServingLayer servingLayer = new ServingLayer(ConfigUtils.getDefault())) { JVMUtils.closeAtShutdown(servingLayer); servingLayer.start(); servingLayer.await(); } } }
public static void main(String[] args) throws Exception { int port = args.length > 0 ? Integer.parseInt(args[0]) : IOUtils.chooseFreePort(); int zkPort = args.length > 1 ? Integer.parseInt(args[1]) : IOUtils.chooseFreePort(); try (final LocalKafkaBroker kafkaBroker = new LocalKafkaBroker(port, zkPort)) { JVMUtils.closeAtShutdown(kafkaBroker); kafkaBroker.start(); kafkaBroker.await(); } }
public static void main(String[] args) throws Exception { int port = args.length > 0 ? Integer.parseInt(args[0]) : IOUtils.chooseFreePort(); try (LocalZKServer zkServer = new LocalZKServer(port)) { JVMUtils.closeAtShutdown(zkServer); zkServer.start(); zkServer.await(); } }
public static void main(String[] args) throws Exception { int port = args.length > 0 ? Integer.parseInt(args[0]) : IOUtils.chooseFreePort(); try (final LocalZKServer zkServer = new LocalZKServer(port)) { JVMUtils.closeAtShutdown(zkServer); zkServer.start(); zkServer.await(); } }