I have a timer configured to run on a timer task object as the below code :
In case the SimpleRunnable thrown a run time exception and that run time exception was not caught, the timer will stop from executing at regular intervals.
Is there any APIs to check if the timer is still running and operating or do I have to implement this functionality myself.
Timer does not give such advanced features but a ScheduledExecutorService does! It returns a future upon successful submission which you can query to get the task status.
Well, before asking this question, I have already implemented my own solution [from scratch] to know if a timer is still running or not.
But it is good idea in software development, to see if others have better solutions or ideas.
Personally, when dealing with core applications and real time applications, I'd rather developing components and implementing such functionalities myself
SCJP, SCJD,SCWCD,SCDJWS,SCEA 5 MCP-C#, MCP-ASP.NET - http://www.khaledinho.com/ Life is the biggest school
Khaled Mahmoud wrote:Personally, when dealing with core applications and real time applications, I'd rather developing components and implementing such functionalities myself
I generally agree. However, when it comes to concurrency I'm all for using code written by someone much cleverer than me.