I have a requirement to post an alarm when some event happens.
I want to write a servlet which will be called at the time of application start up and will stay active as long as application runs.
A thread in that servlet will always monitor for that event due to which alarm will be generated.
I am actually trying to avoid to use thread in the servlet which may cause the application to run slow.
Is there any better way to do that.
Please suggest some code.