Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 26E67105A0 for ; Fri, 15 Nov 2013 19:45:24 +0000 (UTC) Received: (qmail 7789 invoked by uid 500); 15 Nov 2013 19:45:23 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 7635 invoked by uid 500); 15 Nov 2013 19:45:23 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 7514 invoked by uid 99); 15 Nov 2013 19:45:22 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Nov 2013 19:45:22 +0000 Date: Fri, 15 Nov 2013 19:45:22 +0000 (UTC) From: "Woonsan Ko (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (SCXML-167) SimpleScheduler removes wrong Timer 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/SCXML-167?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Woonsan Ko updated SCXML-167: ----------------------------- Fix Version/s: 2.0 > SimpleScheduler removes wrong Timer > ----------------------------------- > > Key: SCXML-167 > URL: https://issues.apache.org/jira/browse/SCXML-167 > Project: Commons SCXML > Issue Type: Bug > Affects Versions: 0.5, 0.6, 0.7, 0.8, 0.9 > Environment: supersteps activated > Reporter: Maikel Linke > Labels: cancel, delay, patch, send, timing > Fix For: 2.0 > > Original Estimate: 1h > Remaining Estimate: 1h > > The SimpleScheduler provides the execution of delayed events. Therefore it uses Timers, stored in a map under the senderid. The Timers start DelayedEventTasks. These tasks trigger the given event and then remove their Timer identified by the senderid. In the case that triggering the event processes a new with the same senderid, the task will remove the wrong (new) Timer from the internal map. This new Timer is unreachable for canceling now. Of course, the senderid should be unique, but cannot be assigned by an expression and the following example fails: > > > > > > > > > > > The solution is very simple: just remove the Timer from the Map first and then trigger the event. > So this code: > public void run() { > try { > executor.triggerEvent(new TriggerEvent(event, > TriggerEvent.SIGNAL_EVENT, payload)); > } catch (ModelException me) { > log.error(me.getMessage(), me); > } > timers.remove(sendId); > if (log.isDebugEnabled()) { > log.debug("Fired event '" + event + "' as scheduled by " > + " with id '" + sendId + "'"); > } > } > Changes to: > public void run() { > timers.remove(sendId); > try { > executor.triggerEvent(new TriggerEvent(event, > TriggerEvent.SIGNAL_EVENT, payload)); > } catch (ModelException me) { > log.error(me.getMessage(), me); > } > if (log.isDebugEnabled()) { > log.debug("Fired event '" + event + "' as scheduled by " > + " with id '" + sendId + "'"); > } > } > It should not brake any logic applied to the internal private Map timers. -- This message was sent by Atlassian JIRA (v6.1#6144)