ScheduledExecutorService progressExecutorService = Executors.newScheduledThreadPool(1);
        ScheduledFuture<?> future = progressExecutorService.scheduleAtFixedRate(new Runnable() {// It begins in 0.5 seconds, and executes once every second.
            @Override
            public void run() {
                System.out.println("excel download progress:"+progress.get()+"%");
                if (progress.get() == 100) {
                    System.out.println("excel download progress is 100%");
                    progressExecutorService.shutdown();
                }
            }
        }, (long) 0.5, 1, TimeUnit.SECONDS);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
猜你喜欢
  • 2021-09-24
  • 2022-01-09
  • 2022-12-23
  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案