/** * Gets the first bStat Metrics class. * * @return The first bStats metrics class. */ private Class<?> getFirstBStatsClass() { Path configPath = configDir.resolve("bStats"); configPath.toFile().mkdirs(); File tempFile = new File(configPath.toFile(), "temp.txt"); try { String className = readFile(tempFile); if (className != null) { try { // Let's check if a class with the given name exists. return Class.forName(className); } catch (ClassNotFoundException ignored) { } } writeFile(tempFile, getClass().getName()); return getClass(); } catch (IOException e) { if (logFailedRequests) { logger.warn("Failed to get first bStats class!", e); } return null; } }