This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Deamon process in J2EE  RSS feed

 
Alan Mc Kernan
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I want to be able to run a deamon process in my J2EE container periodically. I know JBoss has a scheduler but I want my solution to be implementation independent.

This deamon process is just a simple program which "cleans" stale entries in a HashMap based off a timestamp they were entered into the map.

Has anyone any ideas?
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd use the Timer service instead of a Daemon thread, I think you are asking for some problems if you try to do something on your own. Besides, why reinvent the wheel?

Mark
 
Robert Hayes
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used a daemon thread in a J2EE web-app once. I wouldn't do it again, as on various occasions I ended up having a "rogue" thread running around for various reasons -- not the least of which was the application server's quirky behaviour when redeploying.

Now I use a scheduling framework (www.fluxcorp.com) to invoke various listeners that perform such operations.
[ May 03, 2006: Message edited by: Robert Hayes ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!