[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

java timers

Posted on 2012-03-23
6
Medium Priority
?
297 Views
Last Modified: 2012-03-23
Hi. I was instructed about running a program on a schedule. I was told that I could  "use Timer and TimeTask classes or ExctutoThreadPool. ....can also download and use java Quartz library" or I can use the scheduler on Windows.

I need to run this at most 30 times a day. Each time during the day it would be on a different class but the classes would have almost identical code except for one or two lines. But I do not want to run it on Fridays or Saturdays and also on about 12 different holidays during the year.

If I use the scheduler I guess I could set it for Sunday thru Thursday but I would have to remember to cancel it on the holidays.

In this case can I get an opinion again on which would be best?
Thank you.
0
Comment
Question by:onyourmark
  • 4
  • 2
6 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 37756803
why is it so important not to run it on holidays?
what happens if it does rtun?

It seems to be rather tricky to do no matter how you do it
0
 
LVL 47

Accepted Solution

by:
for_yan earned 2000 total points
ID: 37756826
Maybe you would include in the Java code of your task that it would check within the code
that if it is holiday it will exit
And holidays you can provide as arraylist of dates

There are also Java libraries which calculate holidays by country especially when they are moving
holidays
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37756833
check this questions and answers there:
http://stackoverflow.com/questions/1044921/a-good-business-calendar-library-in-java

still I'd go there if there is a very good reson not to run it on holidays
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:onyourmark
ID: 37756844
Hi. I think this is a great idea. If it is a holiday then I will do something special in the code. That is great. Thanks.
0
 

Author Closing Comment

by:onyourmark
ID: 37756850
thanks!
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37756915
You are always welcome.
Indeed, it looks like it is easier to do it in your code, than to seek out this "holiday" functionality in any of schedulers/libraries
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month19 days, 16 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question