[hotfix] 修复因生命周期,getCadThread = 0导致线程池创建失败问题

This commit is contained in:
lujiaming
2023-08-11 19:19:55 +08:00
parent fa2a5d3e35
commit 4a0409953a

View File

@@ -25,6 +25,7 @@ import org.apache.pdfbox.tools.imageio.ImageIOUtil;
import org.apache.poi.EncryptedDocumentException; import org.apache.poi.EncryptedDocumentException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@@ -48,7 +49,7 @@ import java.util.stream.IntStream;
* @date 2017/11/13 * @date 2017/11/13
*/ */
@Component @Component
public class FileHandlerService { public class FileHandlerService implements InitializingBean {
private static final String PDF2JPG_IMAGE_FORMAT = ".jpg"; private static final String PDF2JPG_IMAGE_FORMAT = ".jpg";
private static final String PDF_PASSWORD_MSG = "password"; private static final String PDF_PASSWORD_MSG = "password";
@@ -148,7 +149,11 @@ public class FileHandlerService {
/** /**
cad定义线程池 cad定义线程池
*/ */
private static final ExecutorService pool = Executors.newFixedThreadPool(ConfigConstants.getCadThread()); private ExecutorService pool = null;
@Override
public void afterPropertiesSet() throws Exception {
pool = Executors.newFixedThreadPool(ConfigConstants.getCadThread());
}
/** /**
* 对转换后的文件进行操作(改变编码方式) * 对转换后的文件进行操作(改变编码方式)
* *