[jboss-cvs] javassist/src/main/javassist/util/proxy ...

Shigeru Chiba chiba at is.titech.ac.jp
Thu Nov 2 09:30:22 EST 2006


  User: chiba   
  Date: 06/11/02 09:30:22

  Modified:    src/main/javassist/util/proxy  ProxyFactory.java
  Log:
  slightly changed the caching policy used by ProxyFactory
  
  Revision  Changes    Path
  1.19      +9 -4      javassist/src/main/javassist/util/proxy/ProxyFactory.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ProxyFactory.java
  ===================================================================
  RCS file: /cvsroot/jboss/javassist/src/main/javassist/util/proxy/ProxyFactory.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -b -r1.18 -r1.19
  --- ProxyFactory.java	2 Nov 2006 06:01:21 -0000	1.18
  +++ ProxyFactory.java	2 Nov 2006 14:30:22 -0000	1.19
  @@ -141,11 +141,15 @@
           private MethodFilter filter;
           private int hash;
           WeakReference proxyClass;
  +        MethodHandler handler;
   
  -        public CacheKey(Class superClass, Class[] interfaces, MethodFilter f) {
  +        public CacheKey(Class superClass, Class[] interfaces,
  +                        MethodFilter f, MethodHandler h)
  +        {
               classes = getKey(superClass, interfaces);
               hash = classes.hashCode();
               filter = f;
  +            handler = h;
               proxyClass = null;
           }
   
  @@ -154,7 +158,8 @@
           public boolean equals(Object obj) {
               if (obj instanceof CacheKey) {
                   CacheKey target = (CacheKey)obj;
  -                return target.filter == filter && target.classes.equals(classes);
  +                return target.filter == filter && target.handler == handler
  +                       && target.classes.equals(classes);
               }
               else
                   return false;
  @@ -238,7 +243,7 @@
       }
   
       private void createClass2(ClassLoader cl) {
  -        CacheKey key = new CacheKey(superClass, interfaces, methodFilter);
  +        CacheKey key = new CacheKey(superClass, interfaces, methodFilter, handler);
           synchronized (proxyCache) {
               HashMap cacheForTheLoader = (HashMap)proxyCache.get(cl);
               if (cacheForTheLoader == null) {
  @@ -276,7 +281,7 @@
           WeakReference ref = key.proxyClass;
           if (ref != null) {
               Class c = (Class)ref.get();
  -            if(c != null && getHandler(c) == handler)
  +            if(c != null)
                   return c;
           }
   
  
  
  



More information about the jboss-cvs-commits mailing list