1

Is there a way to set timeout on exectution of task submitted to ThreadPoolTaskExecutor? Otherwise it's possible that pool is wasted on hanged tasks which effectively paralyzes the application.

Denis Kulagin
  • 8,472
  • 17
  • 60
  • 129
  • Did you look at http://stackoverflow.com/questions/4819855/time-limit-on-individual-threads-with-executorservice and work out similar to what is mentioned in this post? – SMA Dec 15 '14 at 09:03
  • check also http://stackoverflow.com/questions/2758612/executorservice-that-interrupts-tasks-after-a-timeout – Joram Dec 15 '14 at 09:04

1 Answers1

2

In short NO.

However there is an API execute(Runnable task, long startTimeout) which has a timeout to indicate the start / execution of task.

Bond - Java Bond
  • 3,972
  • 6
  • 36
  • 59
  • 4
    The problem is that the implementation of this method is: public void execute(Runnable task, long startTimeout) { this.execute(task); } – USer22999299 Dec 11 '16 at 14:38