You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Steve Scheck <ss...@silverspringnet.com> on 2016/02/02 00:04:12 UTC
SchedulerFuture.nextExecutionTime() throws
ArrayIndexOutOfBoundsException
Hello,
When I schedule a schedule a task with IgniteScheduler.scheduleLocal(), then immediately call SchedulerFuture.nextExecutionTime(), Ignite throws an exception:
SchedulerFuture schedulerFuture = scheduler.scheduleLocal(() -> dispatchNow(job), cronString);
long nextExecutionTime = schedulerFuture.nextExecutionTime();
java.lang.ArrayIndexOutOfBoundsException: 0
at org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.nextExecutionTime(ScheduleFutureImpl.java:437) ~[ignite-schedule-1.2.0-incubating.jar!/:1.3.0-incubating]
cronString has the value: {55} 53 3/5 * * * ?
Am I doing something wrong here? The JavaDoc has no stipulation on when nextExecutionTime() may be called after a task is scheduled.
Thanks.
Re: SchedulerFuture.nextExecutionTime() throws ArrayIndexOutOfBoundsException
Posted by Valentin Kulichenko <va...@gmail.com>.
Here is the ticket: https://issues.apache.org/jira/browse/IGNITE-2527
-Val
On Mon, Feb 1, 2016 at 9:12 PM, Valentin Kulichenko <
valentin.kulichenko@gmail.com> wrote:
> Hi Steve,
>
> This happened because the pattern is invalid. It should be "{55, *} 53 3/5
> * * *" (note the second parameter in curly braces). There is an exception
> because of this which immediately completes the future. Calling
> nextExecutionTime() on a completed future leads to this exception, which is
> a bug. I will create a ticket.
>
> -Val
>
> On Mon, Feb 1, 2016 at 9:05 PM, Alexander Bondar <av...@yandex.ru>
> wrote:
>
>> I am not familiar with this API, but it seems these is a bug in sources
>> of this ignite branch (and in master too)
>>
>> 408: public long[] nextExecutionTimes(int cnt, long start) {
>> 409: assert cnt > 0;
>> 410: assert start > 0;
>> 411
>> 412: if (isDone() || isCancelled())
>> 413: return EMPTY_TIMES;
>>
>> 436: public long nextExecutionTime() {
>> 437: return nextExecutionTimes(1, U.currentTimeMillis())[0];
>> 438: }
>>
>> So in case when (isDone() || isCancelled())==true we have EMPTY_TIMES[0]
>> at line# 437
>>
>> 02.02.2016, 05:04, "Steve Scheck" <ss...@silverspringnet.com>:
>>
>> Hello,
>>
>> When I schedule a schedule a task with IgniteScheduler.scheduleLocal(),
>> then immediately call SchedulerFuture.nextExecutionTime(), Ignite throws an
>> exception:
>>
>> SchedulerFuture schedulerFuture =
>> scheduler.scheduleLocal(() -> dispatchNow(job), cronString);
>> long nextExecutionTime =
>> schedulerFuture.nextExecutionTime();
>>
>> java.lang.ArrayIndexOutOfBoundsException: 0
>> at
>> org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.nextExecutionTime(ScheduleFutureImpl.java:437)
>> ~[ignite-schedule-1.2.0-incubating.jar!/:1.3.0-incubating]
>>
>> cronString has the value: {55} 53 3/5 * * * ?
>>
>> Am I doing something wrong here? The JavaDoc has no stipulation on when
>> nextExecutionTime() may be called after a task is scheduled.
>>
>> Thanks.
>>
>>
>>
>>
>>
>>
>
>
Re: SchedulerFuture.nextExecutionTime() throws ArrayIndexOutOfBoundsException
Posted by Valentin Kulichenko <va...@gmail.com>.
Hi Steve,
This happened because the pattern is invalid. It should be "{55, *} 53 3/5
* * *" (note the second parameter in curly braces). There is an exception
because of this which immediately completes the future. Calling
nextExecutionTime() on a completed future leads to this exception, which is
a bug. I will create a ticket.
-Val
On Mon, Feb 1, 2016 at 9:05 PM, Alexander Bondar <av...@yandex.ru> wrote:
> I am not familiar with this API, but it seems these is a bug in sources of
> this ignite branch (and in master too)
>
> 408: public long[] nextExecutionTimes(int cnt, long start) {
> 409: assert cnt > 0;
> 410: assert start > 0;
> 411
> 412: if (isDone() || isCancelled())
> 413: return EMPTY_TIMES;
>
> 436: public long nextExecutionTime() {
> 437: return nextExecutionTimes(1, U.currentTimeMillis())[0];
> 438: }
>
> So in case when (isDone() || isCancelled())==true we have EMPTY_TIMES[0]
> at line# 437
>
> 02.02.2016, 05:04, "Steve Scheck" <ss...@silverspringnet.com>:
>
> Hello,
>
> When I schedule a schedule a task with IgniteScheduler.scheduleLocal(),
> then immediately call SchedulerFuture.nextExecutionTime(), Ignite throws an
> exception:
>
> SchedulerFuture schedulerFuture =
> scheduler.scheduleLocal(() -> dispatchNow(job), cronString);
> long nextExecutionTime =
> schedulerFuture.nextExecutionTime();
>
> java.lang.ArrayIndexOutOfBoundsException: 0
> at
> org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.nextExecutionTime(ScheduleFutureImpl.java:437)
> ~[ignite-schedule-1.2.0-incubating.jar!/:1.3.0-incubating]
>
> cronString has the value: {55} 53 3/5 * * * ?
>
> Am I doing something wrong here? The JavaDoc has no stipulation on when
> nextExecutionTime() may be called after a task is scheduled.
>
> Thanks.
>
>
>
>
>
>