org.aspectj.apache.bcel.util
Class ClassLoaderRepository

java.lang.Object
  extended by org.aspectj.apache.bcel.util.ClassLoaderRepository
All Implemented Interfaces:
Repository

public class ClassLoaderRepository
extends java.lang.Object
implements Repository

The repository maintains information about which classes have been loaded. It loads its data from the ClassLoader implementation passed into its constructor.

See Also:
Repository

Nested Class Summary
static class ClassLoaderRepository.SoftHashMap
           
 
Field Summary
static boolean useSharedCache
           
 
Constructor Summary
ClassLoaderRepository(java.lang.ClassLoader loader)
           
ClassLoaderRepository(ClassLoaderReference loaderRef)
           
 
Method Summary
 void clear()
          Clear all entries from the local cache
 JavaClass findClass(java.lang.String className)
          Find an already defined JavaClass in the local cache.
 JavaClass loadClass(java.lang.Class clazz)
          Find the JavaClass instance for the given run-time class object
 JavaClass loadClass(java.lang.String className)
          Lookup a JavaClass object from the Class Name provided.
 void removeClass(JavaClass clazz)
          Remove class from repository
 java.lang.String report()
          Produce a report on cache usage.
 long[] reportStats()
          Returns an array of the stats, for testing, the order is fixed: 0=time spent loading (static) 1=time spent manipulating URLs (static) 2=classes loaded (static) 3=cache hits shared (static) 4=misses in shared due to eviction (static) 5=cache hits local 6=misses in local due to eviction 7=shared cache size
 void reset()
          Reset statistics and clear all caches
 void storeClass(JavaClass clazz)
          Store a new JavaClass into this Repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

useSharedCache

public static boolean useSharedCache
Constructor Detail

ClassLoaderRepository

public ClassLoaderRepository(java.lang.ClassLoader loader)

ClassLoaderRepository

public ClassLoaderRepository(ClassLoaderReference loaderRef)
Method Detail

storeClass

public void storeClass(JavaClass clazz)
Store a new JavaClass into this Repository.

Specified by:
storeClass in interface Repository

removeClass

public void removeClass(JavaClass clazz)
Remove class from repository

Specified by:
removeClass in interface Repository

findClass

public JavaClass findClass(java.lang.String className)
Find an already defined JavaClass in the local cache.

Specified by:
findClass in interface Repository

loadClass

public JavaClass loadClass(java.lang.String className)
                    throws java.lang.ClassNotFoundException
Lookup a JavaClass object from the Class Name provided.

Specified by:
loadClass in interface Repository
Throws:
java.lang.ClassNotFoundException

report

public java.lang.String report()
Produce a report on cache usage.


reportStats

public long[] reportStats()
Returns an array of the stats, for testing, the order is fixed: 0=time spent loading (static) 1=time spent manipulating URLs (static) 2=classes loaded (static) 3=cache hits shared (static) 4=misses in shared due to eviction (static) 5=cache hits local 6=misses in local due to eviction 7=shared cache size


reset

public void reset()
Reset statistics and clear all caches


loadClass

public JavaClass loadClass(java.lang.Class clazz)
                    throws java.lang.ClassNotFoundException
Description copied from interface: Repository
Find the JavaClass instance for the given run-time class object

Specified by:
loadClass in interface Repository
Throws:
java.lang.ClassNotFoundException

clear

public void clear()
Clear all entries from the local cache

Specified by:
clear in interface Repository