openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1080612 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context: ContextFactory.java CustomPassivatingContextImpl.java
Date Fri, 11 Mar 2011 15:40:59 GMT
Author: struberg
Date: Fri Mar 11 15:40:59 2011
New Revision: 1080612

URL: http://svn.apache.org/viewvc?rev=1080612&view=rev
Log:
OWB-503 remove a few more getService calls

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomPassivatingContextImpl.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java?rev=1080612&r1=1080611&r2=1080612&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
Fri Mar 11 15:40:59 2011
@@ -43,6 +43,8 @@ public final class ContextFactory
     private static final WebBeansLogger logger = WebBeansLogger.getLogger(ContextFactory.class);
     private final WebBeansContext webBeansContext;
 
+    private ContextsService contextsService = null;
+
     public ContextFactory(WebBeansContext webBeansContext)
     {
         this.webBeansContext = webBeansContext;
@@ -53,7 +55,11 @@ public final class ContextFactory
      */
     private ContextsService getContextsService()
     {
-        return webBeansContext.getService(ContextsService.class);
+        if (contextsService == null)
+        {
+            contextsService = webBeansContext.getService(ContextsService.class);
+        }
+        return contextsService;
     }
 
     public void initRequestContext(Object request)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomPassivatingContextImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomPassivatingContextImpl.java?rev=1080612&r1=1080611&r2=1080612&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomPassivatingContextImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomPassivatingContextImpl.java
Fri Mar 11 15:40:59 2011
@@ -30,6 +30,8 @@ import javax.enterprise.context.spi.Crea
  */
 public class CustomPassivatingContextImpl extends CustomContextImpl
 {
+    private SerializableBeanVault sbv = null;
+
     CustomPassivatingContextImpl(Context context)
     {
         super(context);
@@ -37,15 +39,21 @@ public class CustomPassivatingContextImp
 
     public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
     {
-        SerializableBeanVault sbv = WebBeansContext.getInstance().getSerializableBeanVault();
-        
-        return super.get(sbv.getSerializableBean(contextual), creationalContext);
+        return super.get(getSerializableBeanVault().getSerializableBean(contextual), creationalContext);
     }
 
     public <T> T get(Contextual<T> contextual)
     {
-        SerializableBeanVault sbv = org.apache.webbeans.config.WebBeansContext.getInstance().getSerializableBeanVault();
-        return super.get(sbv.getSerializableBean(contextual));
+        return super.get(getSerializableBeanVault().getSerializableBean(contextual));
     }
 
+    private SerializableBeanVault getSerializableBeanVault()
+    {
+        if (sbv == null)
+        {
+            sbv = WebBeansContext.getInstance().getSerializableBeanVault();
+        }
+
+        return sbv;
+    }
 }



Mime
View raw message