mikebrock/mvel — pull request #26 by tpodom (2013-02-10 21:13:22+00:00)
Title: MVEL-237 - Clean up ThreadLocals

Addressing http://jira.codehaus.org/browse/MVEL-237 with a slightly different solution than the original proposed patch.

The finally catch in the MVELRuntime is from what I could tell the best way to make sure that the ThreadLocal is cleaned up at the end of the execution. I'm not sure if there are other entry points but that one seemed the most logical to me to address.

I removed setting the thread local during the setting of the default optimizer to avoid problems with static initializers (such as the one in Drools and in OptimizerFactory itself) from adding a ThreadLocal unintentionally.