[ 
https://issues.apache.org/jira/browse/IGNITE-2527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15383887#comment-15383887
 ] 

Denis Magda commented on IGNITE-2527:
-------------------------------------

[~milap.wadhwa], thanks a lot for the contribution!

I've reviewed, slightly modified and merged your changes. In general I think 
that it's better to return {{0}} rather than {{-1}} if 
{{schedulerFuture.nextExecutionTime()}} is empty just in order to be consistent 
with other time related methods of the scheduler.

> IndexOutOfBoundsException in scheduler future
> ---------------------------------------------
>
>                 Key: IGNITE-2527
>                 URL: https://issues.apache.org/jira/browse/IGNITE-2527
>             Project: Ignite
>          Issue Type: Bug
>          Components: general
>            Reporter: Valentin Kulichenko
>            Assignee: Milap Wadhwa
>            Priority: Minor
>             Fix For: 1.7
>
>
> Calling {{SchedulerFuture.nextExecutionTime()}} (and probably other methods) 
> on a completed future leads to this exception:
> {noformat}
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
>       at 
> org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.nextExecutionTime(ScheduleFutureImpl.java:455)
> {noformat}
> In particular, this happens if {{nextExecutionTime()}} right after calling 
> {{IgniteScheduler.scheduleLocal()}} with an invalid pattern (see code example 
> below). The exception is lost in this case and is never printed out or thrown.
> {code}
> SchedulerFuture schedulerFuture = ignite.scheduler().scheduleLocal(() -> {}, 
> "{55} 53 3/5 * * *");
> long nextExecutionTime = schedulerFuture.nextExecutionTime();
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to