A Question About Execution Schedule

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

A Question About Execution Schedule

Ma GuoWei
Hi,guysThere are some codes in scheduleForExecution Function in Execution.java:
   1.  SlotAllocationFuture future = scheduler.scheduleQueued(toSchedule);   2. future.setFutureAction(new SlotAllocationFutureAction() {......})
When scheduler  finds some slot between line1 and line 2 the scheduler can't get the future action.
Please let me know If I am wrong .
Thanks.    
Reply | Threaded
Open this post in threaded view
|

Re: A Question About Execution Schedule

Till Rohrmann
Hi MaGuoWei,

this is not a problem. If you look at the implementation of
SlotAllocationFuture.setFutureAction, you’ll see that the method is
synchronized on a lock which is also used to complete the future.
Furthermore, you’ll see that the slot variable is checked upon setting an
action and if it’s set the action will immediately be executed. Thus, if in
between calls 1 and 2 the future was completed, then the slot variable
would be set and thus also the action would be executed.

Cheers,
Till


On Wed, Aug 19, 2015 at 5:45 AM, MaGuoWei <[hidden email]> wrote:

> Hi,guysThere are some codes in scheduleForExecution Function in
> Execution.java:
>    1.  SlotAllocationFuture future =
> scheduler.scheduleQueued(toSchedule);   2.
> future.setFutureAction(new SlotAllocationFutureAction() {......})
> When scheduler  finds some slot between line1 and line 2 the scheduler
> can't get the future action.
> Please let me know If I am wrong .
> Thanks.
Reply | Threaded
Open this post in threaded view
|

RE: A Question About Execution Schedule

Ma GuoWei
Thanks Till!

> Date: Wed, 19 Aug 2015 09:31:49 +0200
> Subject: Re: A Question About Execution Schedule
> From: [hidden email]
> To: [hidden email]
>
> Hi MaGuoWei,
>
> this is not a problem. If you look at the implementation of
> SlotAllocationFuture.setFutureAction, you’ll see that the method is
> synchronized on a lock which is also used to complete the future.
> Furthermore, you’ll see that the slot variable is checked upon setting an
> action and if it’s set the action will immediately be executed. Thus, if in
> between calls 1 and 2 the future was completed, then the slot variable
> would be set and thus also the action would be executed.
>
> Cheers,
> Till
> ​
>
> On Wed, Aug 19, 2015 at 5:45 AM, MaGuoWei <[hidden email]> wrote:
>
> > Hi,guysThere are some codes in scheduleForExecution Function in
> > Execution.java:
> >    1.  SlotAllocationFuture future =
> > scheduler.scheduleQueued(toSchedule);   2.
> > future.setFutureAction(new SlotAllocationFutureAction() {......})
> > When scheduler  finds some slot between line1 and line 2 the scheduler
> > can't get the future action.
> > Please let me know If I am wrong .
> > Thanks.