boolean detectContentChanged() {
            File targetFile = new File(filePath);
            if (!targetFile.exists()) {
                if (lastModifiedTimestamp == 0) {
                    //File doesn't exist before, no change detected.
                    return false;
                } else {
                    // File has been deleted. Reset the modified timestamp.
                    lastModifiedTimestamp = 0;
                    return true;
                }
            } else {
                long lastModified = targetFile.lastModified();
                if (lastModified != lastModifiedTimestamp) {
                    // File modified timestamp changed. Need to read the file content.
                    try (FileInputStream fileInputStream = new FileInputStream(targetFile)) {
                        byte[] b = new byte[1024];
                        ByteArrayOutputStream os = new ByteArrayOutputStream();
                        int c;
                        while ((c = fileInputStream.read(b)) != -1) {
                            os.write(b, 0, c);
                        }
                        byte[] newContent = os.toByteArray();
                        if (!Arrays.equals(newContent, fileContent)) {
                            fileContent = newContent;
                            return true;
                        } else {
                            return false;
                        }
                    } catch (FileNotFoundException e) {
                        log.error("The existed file turns to missing, watch file=" + filePath, e);
                    } catch (IOException e) {
                        log.error("Read file failure, watch file=" + filePath, e);
                    } finally {
                        lastModifiedTimestamp = lastModified;
                    }
                }
                return false;
            }
        }
Detect the file content change, if yes, reload the file content into the memory as cached data.

@return true if file content changed.
oap-server/server-library/library-util/src/main/java/org/apache/skywalking/oap/server/library/util/MultipleFilesChangeMonitor.java