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
Rather than try to stuff it into weblogic, why not just run it as a scheduled cron job (or whatever the equivalent is on your platform)? Trying to stuff it into a web app is not necessary or advised.
Thank you for the quick reply, good Sir. So, how do we do that? I deply the said application as jar and create the cron job in LINUX (my server is using LINUX)?
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.
Also if you make the script a database script then you don't even need to start a JVM at all. Just execute the SQL script from cron. There is really no need to use a JVM let alone weblogic for this.