Solved

java timers

Posted on 2012-03-23
6
267 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
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:onyourmark
Comment Utility
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
Comment Utility
thanks!
0
 
LVL 47

Expert Comment

by:for_yan
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now