我正在使用Findbugs,下一个错误是RV_RETURN_VALUE_IGNORED_BAD_PRACTICE,这是我的代码:
ExecutorService executor = Executors.newSingleThreadExecutor();
try {
executor.submit(() -> {
LOGGER.info(
".............",
Some Code.....
});
executor.shutdown();
executor.awaitTermination(5, TimeUnit.SECONDS);
}
catch (InterruptedException e) {
LOGGER.info(".........);
}
finally {
if (!executor.isTerminated()) {
LOGGER.info(.....);
}
executor.shutdownNow();
LOGGER.info(.........);
}
问题在线路上:executor.submit(() -> {
有什么想法吗?
如果您真的不关心执行的结果,那么应该使用executor.execute(()-> {LOGGER.info(...)});
。