org.jruby.util
Class ClassCache<T>

java.lang.Object
  extended by org.jruby.util.ClassCache<T>

public class ClassCache<T>
extends java.lang.Object

A Simple cache which maintains a collection of classes that can potentially be shared among multiple runtimes (or whole JVM).


Nested Class Summary
static interface ClassCache.ClassGenerator
           
static class ClassCache.OneShotClassLoader
           
 
Constructor Summary
ClassCache(java.lang.ClassLoader classLoader)
           
ClassCache(java.lang.ClassLoader classLoader, int max)
          The ClassLoader this class cache will use for any classes generated through it.
 
Method Summary
 java.lang.Class<T> cacheClassByKey(java.lang.Object key, ClassCache.ClassGenerator classGenerator)
           
 void flush()
           
 int getClassLoadCount()
           
 java.lang.ClassLoader getClassLoader()
           
 int getClassReuseCount()
           
 int getLiveClassCount()
           
 int getMax()
           
 boolean isFull()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassCache

public ClassCache(java.lang.ClassLoader classLoader,
                  int max)
The ClassLoader this class cache will use for any classes generated through it. It is assumed that the classloader provided will be a parent loader of any runtime using it.

Parameters:
classLoader - to use to generate shared classes

ClassCache

public ClassCache(java.lang.ClassLoader classLoader)
Method Detail

getClassLoader

public java.lang.ClassLoader getClassLoader()

getMax

public int getMax()

cacheClassByKey

public java.lang.Class<T> cacheClassByKey(java.lang.Object key,
                                          ClassCache.ClassGenerator classGenerator)
                                   throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

flush

public void flush()

isFull

public boolean isFull()

getClassLoadCount

public int getClassLoadCount()

getLiveClassCount

public int getLiveClassCount()

getClassReuseCount

public int getClassReuseCount()


Copyright © 2002-2007 JRuby Team. All Rights Reserved.