4

I am using Spring ThreadPoolTaskExecutor to execute tasks. I want to know the status of the thread in ThreadPoolTaskExecutor, like whether it is finished or in progress or completed. If the task executing thread fails I need to update the subsequent entry of task in taskInfo table to "failed". I have tried the isAlive method of thread to check the thread status but it is always returning true status. What is the best way to know the exact status of a thread in ThreadPoolTaskExecutor.

M. Deinum
  • 115,695
  • 22
  • 220
  • 224
Rosa Mystica
  • 243
  • 1
  • 3
  • 17
  • How about using the built-in [`ListenableFuture`](https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutor.html#submitListenable-java.lang.Runnable-) – Flown Jul 17 '17 at 11:35
  • See https://stackoverflow.com/questions/35571395/how-to-access-running-threads-inside-threadpoolexecutor/35572938#35572938. –  Jul 17 '17 at 11:57

0 Answers0