public static synchronized void loadFile() throws IOException { File f = new File(instance.webhooksFile); Path path = f.toPath(); StringBuilder fullFile = new StringBuilder(); Files.lines(path).forEach(s -> fullFile.append(s)); log.debug("Reading webhooks... " + fullFile.toString()); instance.webhooks = instance.mapper.readValue(fullFile.toString(), Map.class); }
public static synchronized void releaseFile() { instance.supportsFile = false; instance.webhooksFile = null; }
public static synchronized void setFile(String file) { instance.supportsFile = true; instance.webhooksFile = file; }