Dealing with exceptions when using ScheduledThreadPoolExecutor

A

AndyColeman

Hi,

I am using ScheduledThreadPoolExecutor in my code but I have found that
if the Runnable task I supplied throws an exception then this thread
created by the Executor dies. I am sure I have read that the Executor
recreates the thread if it dies due to an exception but I can't find
any reference to that right now.

Is there a pattern I can use for dealing with this case?

Thanks
Andy
 
C

Chris Uppal

AndyColeman said:
I am sure I have read that the Executor
recreates the thread if it dies due to an exception but I can't find
any reference to that right now.

You may be looking for the documentation about the meaning of the core pool
size, see the JavaDoc for the superclass,
java.util.concurrent.ThreadPoolExecutor, and in particular the section headed
"Core and maximum pool sizes".

(According to the documentation for ScheduledThreadPoolExecutor, you can ignore
the stuff about maximum pool size.)

-- chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top