/**
* 异步删除
*
* @param keys
*/
public void asycExecute(String keys) {
ExecutorService executor = Executors.newFixedThreadPool(1);
CompletableFuture<String> future = CompletableFuture.supplyAsync(new Supplier<String>() {
@Override
public String get() {
LOGGER.info("task started!");
try {
// 异步删除
removeAll(keys);
} catch (Exception e) {
LOGGER.info("异步删除出现异常:" + e);
}
return "task finished!";
}
}, executor);
future.thenAccept(e -> System.out.println(e + " 异步删除成功"));
}

相关文章:

  • 2021-11-02
  • 2021-06-15
  • 2021-10-31
  • 2021-10-06
  • 2021-10-21
猜你喜欢
  • 2021-10-03
  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
  • 2021-08-10
  • 2021-09-11
相关资源
相似解决方案