@Override
    public int checkAndSetExpired(long checkTimestamp, long maxValidTimeMs) {
        if (expired.get()) {
            return -1;
        }
        if (closed.get()) {
            return 0;
        }
        if (!mutable) {
            if (checkTimestamp - file.lastModified() > maxValidTimeMs) {
                if (expired.compareAndSet(false, true)) {
                    expiredTime = System.currentTimeMillis();
                }
                return 1;
            }
        }
        return 0;
    }
Check whether this FileSegment is expired, and set expire status.
The last FileSegment cannot be marked expired.

@param checkTimestamp check timestamp.
@param maxValidTimeMs the max expire interval in milliseconds.
@return -1 means already expired, 0 means the last FileSegment, 1 means expired.
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/broker/msgstore/disk/FileSegment.java