Solved

java timers

Posted on 2012-03-23
6
279 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

728 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