• Post Reply Bookmark Topic Watch Topic
  • New Topic

scheduled executors in concurrency  RSS feed

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I want to use scheduled executors which allow use to give specific time after which another round of execution starts.

But what if previous execution is still running?

What is the response of scheduled executor on such scenario?

Please let me know ASAP
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The docs tell you what it does in that situation. Additionally, it's trivial to test it yourself. Just schedule a task to run every 10 seconds that prints out the current time and then sleeps for, say, 17 seconds.

Also, in the future, please EaseUp and refrain from using words like "ASAP" or "urgent." This site is for addressing the technical aspects of your problem only, and your time constraints are not relevant. Bringing them in only detracts from the technical issue at hand, and may drive away people who would otherwise be happy to help you.
 
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can choose what you want to happen by using either the method scheduleAtFixedRate or the method scheduleWithFixedDelay of ScheduledExecutorService. See the API documentation for details.
 
Bramha Bolke
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case next execution will start after current finishes.

But is there any other way to run next execution without waiting for first to complete?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!