public void flush() {
        this.writeLock.lock();
        try {
            // don't perform the i/o process if there's nothing to be written
            if (this.entryQueue.peek() == null) {
                return;
            }

            try {
                List<String> toWrite = new ArrayList<>(this.entryQueue.size());

                // poll the queue for new entries
                for (Action e; (e = this.entryQueue.poll()) != null; ) {
                    toWrite.add(GsonProvider.normal().toJson(ActionJsonSerializer.serialize(e)));
                }

                Files.write(this.contentFile, toWrite, StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.APPEND);
            } catch (IOException e) {
                e.printStackTrace();
            }
        } finally {
            this.writeLock.unlock();
        }
    }
The queue of entries pending save to the file
common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/FileActionLogger.java