[kepler-dev] fireAtCurrentTime issue in DEDirector

Edward A. Lee eal at eecs.berkeley.edu
Thu Jan 10 08:56:30 PST 2008

This looks to me like a concurrency bug in the DEDirector...
You are calling fireAtCurrentTime() from the AWT event thread, which
is a different thread than the execution of the DEDirector.
But fireAtCurrentTime() is supposed to be thread safe.
Apparently, it is not...

I'll take a look.

In the meantime, as a workaround, making the call to fireAtCurrentTime()
inside a ChangeRequest should avoid this problem...


At 01:24 AM 1/10/2008, ian.brown at hsbcib.com wrote:

>        a while back I had some issues firing the DEDirector from a number of threads and the answer was to wrap the firing in a change request. At the time Edward Lee explained that this was necessary because we were using fireAt rather than fireAtCurrentTime. He also made a few changes to the DEDirector to support the change request mechanism. 
>From this, I changed our code so that the asynchronous fireAt() calls are wrapped in a change request and the fireAtCurrentTime() ones are not. That now works pretty well ... but I am occasionally seeing problems with fireAtCurrentTime(). See the following stack trace: 
>ptolemy.kernel.util.IllegalActionException: Attempt to queue an event in the pas 
>t: Current time is 1916.1180000000002 while event time is 1915.915 
>  in .market_tracker_wide.OrderManager.MaintainOrders 
>        at ptolemy.domains.de.kernel.DEDirector._enqueueEvent(DEDirector.java:12 
>        at ptolemy.domains.de.kernel.DEDirector.fireAt(DEDirector.java:625) 
>        at ptolemy.domains.de.kernel.DEDirector.fireAtCurrentTime(DEDirector.jav 
>        at com.hsbc.IMTActors.fix.MaintainOrders.fillNotification(MaintainOrders 
>        at com.hsbc.IMTActors.fix.FixApplication.executionReport(FixApplication. 
>        at com.hsbc.IMTActors.fix.FixApplication.access$100(FixApplication.java: 
>        at com.hsbc.IMTActors.fix.FixApplication$MessageProcessor.run(FixApplica 
>        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) 
>        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) 
>        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre 
>        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread. 
>        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre 
>        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) 
>        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) 
>        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) 
>Does anyone have any idea why this can happen and what I can do it fix it. Would wrapping it in a change request help? It seems a heavyweight solution - I don't care when the DEDirector fires .. I just want to trigger a firing at the next possible opportunity. 
>ps: Edward, we're still working on what we talked about at the end of November. Things here move really slowly in December because of the year end accounting but that's all done now so we should be able to move ahead in the next few weeks. 
>HSBC Bank plc may be solicited in the course of its placement efforts for a new issue, by investment clients of the firm for whom the Bank as a firm already provides other services. It may equally decide to allocate to its own proprietary book or with an associate of HSBC Group. This represents a potential conflict of interest. HSBC Bank plc has internal arrangements designed to ensure that the firm would give unbiased and full advice to the corporate finance client about the valuation and pricing of the offering as well as internal systems, controls and procedures to identify and manage conflicts of interest.
>HSBC Bank plc
>Registered Office: 8 Canada Square, London E14 5HQ, United Kingdom
>Registered in England - Number 14259
>Authorised and regulated by the Financial Services Authority.
>SAVE PAPER - THINK BEFORE YOU PRINT! This transmission has been issued by a member of the HSBC Group "HSBC" for the information of the addressee only and should not be reproduced and/or distributed to any other person. Each page attached hereto must be read in conjunction with any disclaimer which forms part of it. Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. Its contents are based on information obtained from sources believed to be reliable but HSBC makes no representation and accepts no responsibility or liability as to its completeness or accuracy. 
>Kepler-dev mailing list
>Kepler-dev at ecoinformatics.org

Edward A. Lee
Chair of EECS and Robert S. Pepper Distinguished Professor
231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770
phone: 510-642-0253, fax: 510-642-2845
eal at eecs.Berkeley.EDU, http://www.eecs.berkeley.edu/Faculty/Homepages/lee.html  

More information about the Kepler-dev mailing list