Solved

java timers

Posted on 2012-03-23
6
270 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 500 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Application launch issue with Apache Tomcat 5 22
How to parse custom JSON to POJO java 4 56
base64 decode encode 12 121
what is the difference between "sudo su" and "su - root" 6 105
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

920 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

12 Experts available now in Live!

Get 1:1 Help Now