This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Java in General and the fly likes Java Cron Jobs Stop for one hour a day. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Cron Jobs Stop for one hour a day." Watch "Java Cron Jobs Stop for one hour a day." New topic
Author

Java Cron Jobs Stop for one hour a day.

pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85

I am developing java application and in this i wanted to run some method periodically. I have used java schedule to run that method periodically. This is my Cron Expression.

.
This works fine. Now I wanted to stop running this scheduler for one hour per day. How I can write Cron Expression to do it? Give me a idea.

Thanks in advance


Software Engineer(BSC):SCJP 1.5
(Knowledge is power when applied)
RatiKanta pal
Ranch Hand

Joined: Nov 13, 2011
Posts: 76

Hi Pradeep,
Could you please be more clear on whcih hour or any hour can do??

If thats the case(Any hour) you can write the trigger as "0 * 0-22 ? * *" which will trigger every day from 0 to 22th hour and will stop working for the 23rd hour.

pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85

I have done it like this way .
.
Its seem work fine.

Thanks for answer...
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11498
    
  16

I would even say that is the CORRECT way to do it. It is obvious what is intended - that you don't want it to run from 1p - 2p

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Cron Jobs Stop for one hour a day.