Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Java in General and the fly likes Cronjob for a executing a single method of Java class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Cronjob for a executing a single method of Java class" Watch "Cronjob for a executing a single method of Java class" New topic
Author

Cronjob for a executing a single method of Java class

sangram nani
Greenhorn

Joined: Nov 27, 2011
Posts: 21
Hi Friends,

Am a new bie to Java, Currently we are running a daily cronjob of executing a class (a struts2 web application project) which sends an email to two different team @ a specific time. The class includes two methods, one for sending email to sales team, and other for sending email to business team of the list of created keywords on the site that day. The requirement is to send an email to sales team @ a different time, and to business team to other team. So, can i write cron jobs by specifying the method name, so that only that specific method will be executed @ that time.

Thanks.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4167
    
  21

Not directly, your cron job would have to call your application's entry point. Your solution would be to add a parameter to the application which specifies which group to email. Then your application would have to read that parameter and do the right thing based on its value.


Steve
sangram nani
Greenhorn

Joined: Nov 27, 2011
Posts: 21
Thanks Steve for your solution.

Steve Luke wrote:Not directly, your cron job would have to call your application's entry point. Your solution would be to add a parameter to the application which specifies which group to email. Then your application would have to read that parameter and do the right thing based on its value.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Cronjob for a executing a single method of Java class
 
Similar Threads
static methods multiple calls
Java, J2EE, Swing/SWT Developer (Work From Home)
Java Business Development position
Threads
Thread sync issue