2012/3/2 Matteo Cusmai <cusmaimatteo@gmail.com>
i see that there are some other threads that insert new event and some others retract them.
How is the thread model?

Contrary to claims made on this mailing list, StatefulKnowledgeSession is not thread-safe (this may be due to bugs, but bottomline is: it's not thread-safe). In order to avoid errors due to multi-threading, don't use fireUntilHalt(), instead synchronize on the session and only call insert() and fireAllRules() while synchronized on the session:

    synchronized (session) {
        entryPoint.insert(event);
        session.fireAllRules();
    }

-Richard