public DataBlock(String fileName, StoreConfig storeConfig) throws IOException { this.fileName = fileName; this.fileId = Long.parseLong(fileName.substring(0, fileName.lastIndexOf("."))); this.file = new File(storeConfig.getDataPath(), fileName); this.storeConfig = storeConfig; this.fileSize = storeConfig.getDataBlockFileSize(); this.fileHeader = new DataBlockFileHeader(); this.flushDataService = new FlushDataService(); init(); }
flushDataService.start();
@Override public void run() { DataBlock.LOGGER.info(this.getServiceName() + " service started"); while (!this.isStopped()) { try { if (storeConfig.isEnableFlushDataInterval()) { Thread.sleep(storeConfig.getFlushDataInterval()); } else { waitForRunning(storeConfig.getFlushDataInterval()); } // 刷到磁盘 flushDisk(); } catch (Exception e) { DataBlock.LOGGER.error(this.getServiceName() + " error:" + e.getMessage(), e); } } } }
public DataBlock(String fileName, StoreConfig storeConfig) throws IOException { this.fileName = fileName; this.fileId = Long.parseLong(fileName.substring(0, fileName.lastIndexOf("."))); this.file = new File(storeConfig.getDataPath(), fileName); this.storeConfig = storeConfig; this.fileSize = storeConfig.getDataBlockFileSize(); this.fileHeader = new DataBlockFileHeader(); this.flushDataService = new FlushDataService(); init(); }
flushDataService.start();
flushDataService.start();
@Override public void run() { DataBlock.LOGGER.info(this.getServiceName() + " service started"); while (!this.isStopped()) { try { if (storeConfig.isEnableFlushDataInterval()) { Thread.sleep(storeConfig.getFlushDataInterval()); } else { waitForRunning(storeConfig.getFlushDataInterval()); } // 刷到磁盘 flushDisk(); } catch (Exception e) { DataBlock.LOGGER.error(this.getServiceName() + " error:" + e.getMessage(), e); } } } }
@Override public void run() { DataBlock.LOGGER.info(this.getServiceName() + " service started"); while (!this.isStopped()) { try { if (storeConfig.isEnableFlushDataInterval()) { Thread.sleep(storeConfig.getFlushDataInterval()); } else { waitForRunning(storeConfig.getFlushDataInterval()); } // 刷到磁盘 flushDisk(); } catch (Exception e) { DataBlock.LOGGER.error(this.getServiceName() + " error:" + e.getMessage(), e); } } } }
public DataBlock(String fileName, StoreConfig storeConfig) throws IOException { this.fileName = fileName; this.fileId = Long.parseLong(fileName.substring(0, fileName.lastIndexOf("."))); this.file = new File(storeConfig.getDataPath(), fileName); this.storeConfig = storeConfig; this.fileSize = storeConfig.getDataBlockFileSize(); this.fileHeader = new DataBlockFileHeader(); this.flushDataService = new FlushDataService(); init(); }