commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r799700 - /commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.java
Date Fri, 31 Jul 2009 19:05:03 GMT
Author: sebb
Date: Fri Jul 31 19:05:03 2009
New Revision: 799700

URL: http://svn.apache.org/viewvc?rev=799700&view=rev
Log:
Add a bit of Javadoc
Use IODH to return Singleton factory instance

Modified:
    commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.java

Modified: commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.java?rev=799700&r1=799699&r2=799700&view=diff
==============================================================================
--- commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.java
(original)
+++ commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.java
Fri Jul 31 19:05:03 2009
@@ -42,6 +42,8 @@
 /**
  * Implements the Jexl ScriptEngine for JSF-223.
  * <p>
+ * This implementation only gives access to the ENGINE_SCOPE bindings.
+ * </p>
  * See
  * <a href="http://java.sun.com/javase/6/docs/api/javax/script/package-summary.html">Java
Scripting API</a>
  * Javadoc.
@@ -121,7 +123,12 @@
 
     /** {@inheritDoc} */
     public ScriptEngineFactory getFactory() {
-        return factory == null ? new JexlScriptEngineFactory() : factory;
+        return factory == null ? SingletonHolder.DEFAULT_FACTORY : factory;
+    }
+
+    // IODH - lazy initialisation
+    private static class SingletonHolder {
+        private static final JexlScriptEngineFactory DEFAULT_FACTORY = new JexlScriptEngineFactory();
     }
 
     /**



Mime
View raw message