ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Milap Wadhwa (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IGNITE-2527) IndexOutOfBoundsException in scheduler future
Date Sat, 16 Jul 2016 04:21:20 GMT

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

Milap Wadhwa commented on IGNITE-2527:


I have looked into the issue and here are my findings :

schedulerFuture.nextExecutionTime() is trying to caste Empty Array element (first element)
to Long. Thats why It is throwing ArrayOutOfBoundException
schedulerFuture.nextExecutionTime() internally invokes nextExecutionTimes() which in case
If scheduler is finished will returns Empty Long Array. 
As schedulerFuture.nextExecutionTime() returns Long, It has to caste Array Elements returned
from nextExecutionTimes() to Long which is empty in this case. Hence throwing ArrayOutOfBoundException
I am keeping schedulerFuture.nextExecutionTime() default termination value as -1.
If agree on design, I am going ahead with sending the pull request.

Please let me know If you need more info on it. 

Milap Wadhwa

> 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

View raw message