[rules-dev] Re: IMPORTANT: Time cheat sheet

Michael Neale michael.neale at gmail.com
Mon Jan 19 18:24:22 EST 2009


well I think its just as east to review the code to make sure they are
refactored accordingly. I don't think anything more complex is
warranted.

The only time i think I use it is for testing really.



On Tue, Jan 20, 2009 at 4:09 AM, Edson Tirelli <tirelli at post.com> wrote:
>
>    All,
>
>    This applies to the core engine itself and anyone touching its code.
>    As we move to a time-controlled engine in Drools 5, we need to be aware
> of a few things when developing our code:
>
> 1. We need to have a synchronization clock, and we do: in the
> InternalWorkingMemory interface:
>
>     public TimerService getTimerService();
>
>     TimerService has a method to get the current time:
>
>     public long getCurrentTime();
>
>     This means you should NEVER EVER EVER NEVER EVER use
> System.currentTimeMillis() again... if you see it in the code, please either
> fix it or add a FIXME tag and let me know so that I can fix it. I am
> cleaning up things right now.
>
>      The reason is obvious: controlling the synchronization clock means we
> control time as the engine sees it, so that we can use real time clocks,
> pseudo clocks controlled by the application, heart beat clocks, etc. This is
> also a requirement for us to implement clusters and distributed agents.
>
>      We still have a lot to fix on the serialization side of things for
> serializing scheduled executions, but lets see how this goes.
>
> 2. We need to have a synchronization clock, meaning if you use anything else
> as a clock, we need to remove it and make sure it is using the TimerService.
> I know Guvnor uses a TimerMachine class... I didn't had the time to look
> into this yet, but we will need to make sure it either starts using the
> TimerService or is synchronized with it.
>
> 3. Thread creation: make sure you don't execute anything assynchronously
> with your own created threads. We need to implement a factory based thread
> creation for the cases where we have to spawn threads.
>
>    Thanks,
>       Edson
>
>
>
> --
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss, a division of Red Hat @ www.jboss.com
>



-- 
Michael D Neale
home: www.michaelneale.net
blog: michaelneale.blogspot.com



More information about the rules-dev mailing list