use of com.dtstack.flinkx.connector.ftp.client.excel.ExcelReaderExecutor in project chunjun by DTStack.
the class ExcelFileReadClient method open.
@Override
public void open(InputStream inputStream, FtpConfig ftpConfig) throws IOException {
cellCount = ftpConfig.getColumn().size();
ExcelReadListener listener = new ExcelReadListener();
queue = listener.getQueue();
ExcelReaderBuilder builder = EasyExcel.read(inputStream, listener);
if (!ftpConfig.getIsFirstLineHeader()) {
builder.headRowNumber(0);
}
builder.ignoreEmptyRow(true);
ExcelReader reader = builder.build();
sheetNum = reader.excelExecutor().sheetList().size();
executorService = new ThreadPoolExecutor(1, 1, 0, NANOSECONDS, new LinkedBlockingDeque<>(2), new BasicThreadFactory.Builder().namingPattern("excel-schedule-pool-%d").uncaughtExceptionHandler(new ExcelReaderExceptionHandler()).daemon(false).build());
ExcelReaderExecutor executor = new ExcelReaderExecutor(reader);
executorService.execute(executor);
}
Aggregations