You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Lukasz Lenart (JIRA)" <ji...@apache.org> on 2013/12/31 14:30:50 UTC
[jira] [Updated] (OGNL-181) OgnlRuntime.getCompiler and
thread-safety.
[ https://issues.apache.org/jira/browse/OGNL-181?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart updated OGNL-181:
-------------------------------
Fix Version/s: 4.0.x
> OgnlRuntime.getCompiler and thread-safety.
> ------------------------------------------
>
> Key: OGNL-181
> URL: https://issues.apache.org/jira/browse/OGNL-181
> Project: Commons OGNL
> Issue Type: Bug
> Reporter: Maurizio Cucchiara
> Priority: Minor
> Labels: concurrency, thread-safety
> Fix For: 4.0.x
>
>
> As you can see, {{getCompiler}} is not thread safe.
> I recently added a new performance benchmark to test its 3d-safety and performance: during my tests I have experienced a fast execution on unsafe version vs the safe one (though every concurrent test instantiated a new compiler).
> I have not yet investigated and I still don't know what can cause running more than one instance of the compiler in the same jvm. If necessary we can consider to make compiler a singleton in order to enforce this concept.
>
> What do you think guys?
> {code}
> public static OgnlExpressionCompiler getCompiler( OgnlContext ognlContext )
> {
> if ( _compiler == null )
> {
> try
> {
> OgnlRuntime.classForName( ognlContext, "javassist.ClassPool" );
> _compiler = new ExpressionCompiler();
> }
> catch ( ClassNotFoundException e )
> {
> throw new IllegalArgumentException(
> "Javassist library is missing in classpath! Please add missed dependency!", e );
> }
> }
> return _compiler;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)