Return-Path: X-Original-To: apmail-zest-dev-archive@minotaur.apache.org Delivered-To: apmail-zest-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 502C1184DB for ; Sat, 14 Nov 2015 02:39:11 +0000 (UTC) Received: (qmail 60689 invoked by uid 500); 14 Nov 2015 02:39:11 -0000 Delivered-To: apmail-zest-dev-archive@zest.apache.org Received: (qmail 60605 invoked by uid 500); 14 Nov 2015 02:39:11 -0000 Mailing-List: contact dev-help@zest.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zest.apache.org Delivered-To: mailing list dev@zest.apache.org Received: (qmail 60534 invoked by uid 99); 14 Nov 2015 02:39:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Nov 2015 02:39:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id E6A4E2C0452 for ; Sat, 14 Nov 2015 02:39:10 +0000 (UTC) Date: Sat, 14 Nov 2015 02:39:10 +0000 (UTC) From: "Niclas Hedhman (JIRA)" To: dev@zest.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ZEST-128) Scheduler Library looses schedules MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/ZEST-128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15005107#comment-15005107 ] Niclas Hedhman commented on ZEST-128: ------------------------------------- I have removed transient schedules. Only Durable ones now exists. The flow is roughly like this; ExecutionMixin manages the timingQueue, where each Schedule's next execution time is stored. The timingQueue is a SortedSet (TreeSet) ExecutionMixin waits until the first entry is time to execute. It then removes the entry from the timingQueue, updates the Schedule's nextRun. If the nextRun is "some time" (!= Long.MIN_VALUE) the ScheduleTime is placed back on the timingQueue. ExecutionMixin then submits a TaskRunner to handle the execution of a Schedule's Task. TaskRunner manages the Schedule's state machine, i.e. starting, completedSuccesssful, completedException. UnitOfWorkPropogation is used for the TaskRunner, but it has no Retry. The Task can either use the UnitOfWork that is created in the TaskRunner[UowConcern], OR if the Task wants its own Usecase, Retry or DiscardOn options, those can be declared on the run() method of the Task. Task declares the UnitOfWorkConcern, so no additional declaration required; {code} @Override @UnitOfWorkPropagation( usecase = "Fetch Load Data" ) @UnitOfWorkRetry( retry = 5, initialDelay = 10000, delayFactory = 10000 ) @UnitOfWorkDiscardOn( LoadDataDeclarationNotValidException.class ) public void run() { : {code} > Scheduler Library looses schedules > ---------------------------------- > > Key: ZEST-128 > URL: https://issues.apache.org/jira/browse/ZEST-128 > Project: Zest > Issue Type: Bug > Affects Versions: 2.1 > Reporter: Niclas Hedhman > Assignee: Niclas Hedhman > Priority: Critical > > The Scheduler Library doesn't manage to keep the schedules running. Some seems to get lost, and many are never run at all. > I have modified the existing test case to show that being the case. Below, the task is only run once. > From my app, I am pretty sure it doesn't matter whether it is the same Task instance or separate instances... They get lost... > {code:Title=SchedulerTest.java} > @Test > public void testOnce() > throws UnitOfWorkCompletionException > { > final Usecase usecase = UsecaseBuilder.newUsecase( "TestOnce" ); > final String taskIdentity; > try( UnitOfWork uow = module.newUnitOfWork( usecase ) ) > { > Scheduler scheduler = module.findService( Scheduler.class ).get(); > FooTask task = createFooTask( uow, usecase.name(), BAZAR ); > taskIdentity = task.identity().get(); > scheduler.scheduleOnce( task, 1, true ); > scheduler.scheduleOnce( task, 2, true ); > scheduler.scheduleOnce( task, 3, true ); > scheduler.scheduleOnce( task, 4, true ); > uow.complete(); > } > await( usecase.name() ) > .until( taskOutput( taskIdentity ), equalTo( 4 ) ); > } > {code} > {code:Title=FooTask.java} > @UseDefaults > Property runCounter(); > abstract class Mixin > implements Runnable > { > : > : > : > @Override > public void run() > { > synchronized( this ) > { > me.runCounter().set( me.runCounter().get() + 1 ); > } > : > : > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)