This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I've created a project with one main function. The main function will perform a routine database cleanup every 5 minutes. Does anyone know how to do this in weblogic 10.3? should I deploy in jar? or exploded folder will be okay? Should I put the main function inside servlet? thanks
If your server is Linux, then a cron job is the way to go. It can start up the Java app periodically so that it can perform its cleanup and then exit.
Joined: Aug 07, 2013
okay, lets say I've modified the main method to use ScheduledExecutorService and Runnable methods so the main method will do the cleanup periodically, that would mean I don't need to create the cronjob? thanks
Theoretically you wouldn't. But the job may crash, and would need to be restarted by hand. Or the machine is rebooted. Or you want to pause it. All these scenarios are handled easily if the job gets executed via cron (instead of having it run all the time and doing the scheduling internally). So I would still advise to use a cron job for starting it.