public class Weaver
extends java.lang.Object
Constructor and Description |
---|
Weaver() |
Modifier and Type | Method and Description |
---|---|
static <T extends Freezable> |
genDelegate(int id,
java.lang.Class<T> clazz) |
static java.lang.reflect.Field[] |
getWovenFields(java.lang.Class clz)
Get all woven fields in this class, including subclasses, up to the
normal
Iced serialization classes, skipping static and transient
fields, and the required _ice_id field. |
static void |
loadDynamic(java.lang.String name,
byte[] b)
Load/Reload classes defined at runtime.
|
public static java.lang.reflect.Field[] getWovenFields(java.lang.Class clz)
Iced
serialization classes, skipping static and transient
fields, and the required _ice_id field.Field
holding the list of woven fields.public static <T extends Freezable> Icer<T> genDelegate(int id, java.lang.Class<T> clazz)
public static void loadDynamic(java.lang.String name, byte[] b)
ClassPool
, and then javassistLoadClass(int, Class)
resolves the generation of (de)serializers. In order to reload classes, though,
each dynamically loaded class must have its very own ClassLoader
, and all
previous Icer
s must be removed. In order to maintain cluster-wide coherency
about which classes are loaded, the TypeMap
is likewise updated whenever a class
is reloaded.
In order to successfully load classes at runtime (for example a subclass of MRTask
),
each node takes the bytecode and class name and puts a new ByteArrayClassPath
onto
_pool
's classpath. Since there is no mechanism for retrieving these
ClassPath
instances later, they are stored in CLASSPATHS
so that
reload events can remove the old paths. Similarly, CLASSLOADERS
holds on
to the loaders of dynamically created classes so that classes can be reloaded and old
ClassLoader
instances pruned.
Finally, in order to genDelegate(int, Class)
during a class reload, then the
previous Icer
must be CtClass.detach()
ed. In addition, the TypeMap.goForGold(int)
must turn a null for the Icer
.name
- class nameb
- bytecode