Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cronjob for a executing a single method of Java class

 
sangram nani
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
22
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sangram nani
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic