• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scheduling task execution in defined intervalls

 
Gabriel Beres
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I would like to schedule task execution in bit complicated way.

I want to split a day into intervals, and define the periods of the task execution within these time intervalls.

For example:

8:00am to 13:00pm = 5000 (milliseconds)
13:00pm to 21:00pm = 3000

So, between the first period i want periodic task execution in 5 seconds, and for the latter 3 seconds.

Are there some scheduling framework which supports this, or shall i implement it with Timer?
If only the latter is possible any hint would be nice.

Thanks
 
Karthik Shiraly
Bartender
Posts: 1207
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check if Quartz scheduler framework's cron-like trigger expressions do what you want - see the examples at the bottom of the page. 2 expressions - one for 5 second tasks and one for 3 second tasks - will probably be enough.
 
Vineeth Arvind
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try if This might help. This is using Timer and TimerTask. Currently i'm using threads for tasks.
You can change accordingly.

 
Chinna Eranna
Ranch Hand
Posts: 174
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also look at ScheduledExecutorService class.
 
Ramesh Sunkara
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quartz is always a better option.you will have lot of options to scedule a job.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quartz is always a better option.you will have lot of options to scedule a job.

I disagree. Just because it has more options does not mean it is the better choice for all situations. It also has higher overhead for settings things up, making its use questionable if the extra options aren't needed.
 
Ramesh Sunkara
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya I do accept. I should have not used the word "always"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic