You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2006/10/27 17:15:10 UTC

svn commit: r468408 - /incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java

Author: rickhall
Date: Fri Oct 27 08:15:09 2006
New Revision: 468408

URL: http://svn.apache.org/viewvc?view=rev&rev=468408
Log:
Modified the filter implementation so that it would not cache passed in
dictionaries and service references inside its property mapper for the
LDAP evaluator. This was causing a somewhat benign garbage collection
issue.

Modified:
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java?view=diff&rev=468408&r1=468407&r2=468408
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java (original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java Fri Oct 27 08:15:09 2006
@@ -129,8 +129,13 @@
     {
         try
         {
+            // Since the mapper instance is reused, we should
+            // null the source after use to avoid potential
+            // garbage collection issues.
             m_mapper.setSource(dict, false);
-            return m_evaluator.evaluate(m_mapper);
+            boolean result = m_evaluator.evaluate(m_mapper);
+            m_mapper.setSource(null, false);
+            return result;
         }
         catch (AttributeNotFoundException ex)
         {
@@ -155,8 +160,13 @@
     {
         try
         {
+            // Since the mapper instance is reused, we should
+            // null the source after use to avoid potential
+            // garbage collection issues.
             m_mapper.setSource(ref);
-            return m_evaluator.evaluate(m_mapper);
+            boolean result = m_evaluator.evaluate(m_mapper);
+            m_mapper.setSource(null);
+            return result;
         }
         catch (AttributeNotFoundException ex)
         {
@@ -169,12 +179,17 @@
         return false;
     }
 
-    public boolean matchCase(Dictionary dictionary)
+    public boolean matchCase(Dictionary dict)
     {
         try
         {
-            m_mapper.setSource(dictionary, true);
-            return m_evaluator.evaluate(m_mapper);
+            // Since the mapper instance is reused, we should
+            // null the source after use to avoid potential
+            // garbage collection issues.
+            m_mapper.setSource(dict, true);
+            boolean result = m_evaluator.evaluate(m_mapper);
+            m_mapper.setSource(null, true);
+            return result;
         }
         catch (AttributeNotFoundException ex)
         {