0

I have a Java servlet, which invokes a thread that establishes connection with a mail server. After everything is successful, it starts a thread that keeps reading mails in inbox. This thread runs in infinite while loop, and keeps running, until it stops either by an exception or when tomcat server terminates.

Now, whenever there is an exception, we have no way of knowing if this email parser is working or not.

I am creating a web page, which should somehow check if the thread is working or not? How can I achieve this in java servlet ?

I am aware of Thread.isAlive() function. But how will I get the reference of same Thread object in another servlet?

If this helps - The web console is another php application, which hits the servlet via curl request. I have achieved all the integration. All I want to know is how can I call Thread.isAlive(...) on the original Thread object reference which started the Thread in the first place

Or if there is any other way, I am open to that.

zookastos
  • 795
  • 7
  • 31

0 Answers0