Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 68046 invoked from network); 2 Jul 2010 20:42:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Jul 2010 20:42:02 -0000 Received: (qmail 56214 invoked by uid 500); 2 Jul 2010 20:42:01 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 56057 invoked by uid 500); 2 Jul 2010 20:42:00 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 56049 invoked by uid 99); 2 Jul 2010 20:42:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Jul 2010 20:42:00 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rahul.akolkar@gmail.com designates 209.85.212.43 as permitted sender) Received: from [209.85.212.43] (HELO mail-vw0-f43.google.com) (209.85.212.43) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Jul 2010 20:41:52 +0000 Received: by vws4 with SMTP id 4so3912317vws.30 for ; Fri, 02 Jul 2010 13:41:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=JiInyd+dPPE0Eo211/H7OTyj5OFJ339yUbjZ4q/h2Ic=; b=aMH+dbNteqONeMY/lKOrWwMLwKB0JAvmQKRY0/B1pE801VftEf93StiOpNVwWupJ8d 3iO7JoepgOtggf2XRHJnsj14ZcVqsUbuPDMb2woffoUriHq7beergSZKf1TM8pU9ibD+ 2Zv8KkfoVP+NRjxYxXBE63O9upacThDcx1rI4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=hpQVFNjVa63f8o7aQULF9hT8hafX5ShdIDRBlAuaT/gp59LLAZHYse/J4uZFSR2Kep BMykPgSm/O/iJF6RtBnIDp57+2+the0cg1oFL1RtiTFFp8qFXUFbN7PwN6aWeCkOrSdi UB9jAglGMdyekecgVcLOzzlAZcBPaTfFVMbA4= MIME-Version: 1.0 Received: by 10.220.129.15 with SMTP id m15mr681363vcs.198.1278103291266; Fri, 02 Jul 2010 13:41:31 -0700 (PDT) Received: by 10.220.104.140 with HTTP; Fri, 2 Jul 2010 13:41:31 -0700 (PDT) In-Reply-To: <1278032214424-2275888.post@n4.nabble.com> References: <1278032214424-2275888.post@n4.nabble.com> Date: Fri, 2 Jul 2010 16:41:31 -0400 Message-ID: Subject: Re: [scxml] stop and resume by serializing the executor does not work From: Rahul Akolkar To: Commons Users List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Jul 1, 2010 at 8:56 PM, RT wrote: > > My scxml is defined like this: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > > So, I initiate an SCXMLExecutor object, set all the requisites and call g= o() > , like this: > > SCXMLExecutor engine =3D new SCXMLExecutor(getEvaluator(), new > SimpleDispatcher(), > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0new Simple= ErrorReporter()); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0engine.setStateMachine(getSCXML()); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0engine.setSuperStep(true); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0engine.setRootContext(getContext()); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0engine.addListener(getSCXML(), getListener= ()); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0try { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0engine.go(); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} catch (ModelException me) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0me.printStackTrace(); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > > In the listener, I override the onEntry like this: > > public void onEntry(TransitionTarget state) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0System.out.println("Entering state " + sta= te.getId()); > =A0 =A0 =A0 =A0} > > After I call go() on my executor, I see the stateA being entered and then > the state machine stops as its waiting for the "gotoB" event to transitio= n > to the next state. > > Now, I serialize this executor object to a file.Wait for a few seconds, t= hen > deserialize it and then call fireEvent("gotoB") which is defined as: > > public void fireEvent(String eventName) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0try { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0executor.triggerEvent(new = TriggerEvent(eventName, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0TriggerEvent.SIGNAL_EVENT)); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0System.out.println("fired = eventsuccessfully:"+eventName); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} catch (ModelException e) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0e.printStackTrace(); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0} > > I see in the log that my event was fired on the executor, but I do not se= e > the stateB being entered. To confirm, rather than rely on any listener output, introspect the executor directly. So, after the System.out.println line above, check the active state(s) via executor.getCurrentStatus().getStates() -- one would expect "stateB" as the ID of the active state in this case. > So obviously during serialization/deserialization > some entities were lost on the executor object. Any idea what I should be > looking for? > We do serialization round trips and have tests for it as well. Assumption is that all application provided listeners, data, dispatchers, invokers etc. are serializable (check that is the case here). Another thing to do would be to create a unit test for the Commons SCXML test suite that demonstrates what you are observing and then we can look at it. -Rahul --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org