Solved

java timers

Posted on 2012-03-23
6
273 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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…

832 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