[jboss-cvs] JBossAS SVN: r105471 - projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/visitor.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 1 08:38:58 EDT 2010


Author: alesj
Date: 2010-06-01 08:38:57 -0400 (Tue, 01 Jun 2010)
New Revision: 105471

Modified:
   projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/visitor/CachingReflectProvider.java
Log:
Reset cache.

Modified: projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/visitor/CachingReflectProvider.java
===================================================================
--- projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/visitor/CachingReflectProvider.java	2010-06-01 12:28:43 UTC (rev 105470)
+++ projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/visitor/CachingReflectProvider.java	2010-06-01 12:38:57 UTC (rev 105471)
@@ -22,8 +22,7 @@
 
 package org.jboss.scanning.plugins.visitor;
 
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
 
 import org.jboss.classloading.spi.visitor.ResourceContext;
 import org.jboss.reflect.spi.TypeInfo;
@@ -36,7 +35,7 @@
 public class CachingReflectProvider implements ReflectProvider
 {
    private ReflectProvider delegate;
-   private Map<ResourceContext, TypeInfo> cache = new HashMap<ResourceContext, TypeInfo>();
+   private volatile Map<ResourceContext, TypeInfo> cache = new HashMap<ResourceContext, TypeInfo>();
 
    public CachingReflectProvider(ReflectProvider delegate)
    {
@@ -55,4 +54,25 @@
       }
       return result;
    }
+
+   public void reset()
+   {
+      Map<ResourceContext, TypeInfo> tmp = cache;
+      // dummy cache, go to delegate from now on
+      cache = new AbstractMap<ResourceContext, TypeInfo>()
+      {
+         @Override
+         public Set<Entry<ResourceContext, TypeInfo>> entrySet()
+         {
+            return Collections.emptySet();
+         }
+
+         @Override
+         public TypeInfo put(ResourceContext key, TypeInfo value)
+         {
+            return null;
+         }
+      };
+      tmp.clear();
+   }
 }
\ No newline at end of file




More information about the jboss-cvs-commits mailing list