static AutoCloseable serverSocketFactory_autoUpdate() { temp new CloseablesHolder resources; new FileWatchService watchService; resources.add(watchService); File dir = javaxSecretDir(); watchService.addRecursiveListener(dir, f -> enter { if (fileNameIs(f, "keystore.p12")) { print("Key store changed, reloading certificates: " + f); serverSocketFactory_botCompanyEtc_update(); } }); print("Watching " + dir + " for keystore changes"); ret resources.takeOut(watchService); }