Hi guys. I'm studying for ocp8 exam from OCP study guide of jeanne and scott chapter 7 about Concurrency.
I'm gonna transcribe what the books says:
Given: service.scheduleAtFixedRate(command, 5, 1, TimeUnit.MINUTES);
This example executes a Runnable task every minute, following an initial five-minute delay
One risk of using this method is the possibility a task could consistently take longer to run than the period between tasks.
Up to here what I understand is that for example in this case on the first minute a task is created and submitted and then it's gonna take 5 minutes to be executed. And in the minute number two ( while the first task is on delaying) another task is submitted and so on.
What would happen if the task consistently took five minutes to execute?
Despite the fact that the task is still running, the ScheduledExecutorService would submit a new task to be started every minute.
-> And now what I'm not understandying:
If a single thread executor was used, over time this would result in endless set tasks being scheduled, which would run back to back assuming that no other tasks were submitted to the ScheduledExecutorService.
Especially I can't totally undertand the following: "this would result in endless set tasks being scheduled, which would run back to back assuming that no other tasks were submitted"
I can guess that a stack of tasks would be piled up as if there was not every minute a new task being submitted.
Right. It's like I give you a piece of paper to hold. And I say that I will come by to get the papers one at a time, but every time I will leave you with 5 new papers. So every time I show up you have more and more to hold. But you never get any closer to being done because I drop off more than I retrieve.
By the way, because of personal motives I will have to move the date of my exam for later. I was expecting take it on December but I think it will be on March or April. So my question is when do you think OCP 8 will be removed by Oracle. Or if in other cases they did let people known with anticipation.
Pablo Napoli wrote:. . . when do you think OCP 8 will be removed by Oracle. . . .
Don't know. Have you looked on the Oracle exams website? Last time they removed any exams, for Java6/7, they gave lots of notice, I think over 1½ years, so I think you still have a long time to sit a Java8 exam.