class DefaultFlushManager implements FlushManager { private final FlushCommitLogService flushCommitLogService; //If TransientStorePool enabled, we must flush message to FileChannel at fixed periods private final FlushCommitLogService commitRealTimeService;
public DefaultFlushManager() { if (FlushDiskType.SYNC_FLUSH == CommitLog.this.defaultMessageStore.getMessageStoreConfig().getFlushDiskType()) { this.flushCommitLogService = new CommitLog.GroupCommitService();//同步 } else { this.flushCommitLogService = new CommitLog.FlushRealTimeService();//异步 } this.commitRealTimeService = new CommitLog.CommitRealTimeService(); }
@Override public void start() { this.flushCommitLogService.start(); if (defaultMessageStore.isTransientStorePoolEnable()) { this.commitRealTimeService.start(); } }