public boolean tryRollingFile(long interval) {
        FileSegment fileSegment = this.getFileToWrite();
        long timestamp = fileSegment.getMinTimestamp();
        if (timestamp != Long.MAX_VALUE && timestamp + interval < System.currentTimeMillis() &&
            fileSegment.getAppendPosition() >=
                fileSegmentFactory.getStoreConfig().getCommitLogRollingMinimumSize()) {
            this.rollingNewFile(this.getAppendOffset());
            return true;
        }
        return false;
    }
@Test
    public void tryRollingFileTest() throws InterruptedException {
        String filePath = MessageStoreUtil.toFilePath(queue);
        FlatCommitLogFile flatFile = flatFileFactory.createFlatFileForCommitLog(filePath);
        for (int i = 0; i < 3; i++) {
            ByteBuffer byteBuffer = MessageFormatUtilTest.buildMockedMessageBuffer();
            byteBuffer.putLong(MessageFormatUtil.QUEUE_OFFSET_POSITION, i);
            Assert.assertEquals(AppendResult.SUCCESS, flatFile.append(byteBuffer, i));
            TimeUnit.MILLISECONDS.sleep(2);
            storeConfig.setCommitLogRollingMinimumSize(byteBuffer.remaining());
            Assert.assertTrue(flatFile.tryRollingFile(1));
        }
        Assert.assertEquals(4, flatFile.fileSegmentTable.size());
        Assert.assertFalse(flatFile.tryRollingFile(1000));
        flatFile.destroy();
    }