org.springsource.loaded
Class MethodInvokerRewriter
java.lang.Object
org.springsource.loaded.MethodInvokerRewriter
public class MethodInvokerRewriter
- extends java.lang.Object
Rewrite method calls and field accesses. This is not only references to reloadable types but also calls to reflective APIs which
must be intercepted in case they refer to reloadable types at runtime.
The MethodInvokerRewriter actually manages a portion of the .slcache - it keeps track of two things:
- There is an index file (.index) that records types and whether they were modified on a previous run. A later run can then
quickly determine it doesn't need to do anything, or if it should look for a cache file containing the modified form.
- There is a file 'per-modified-file' that captures the previously determined woven form of the class. The files are named
after the classname suffixed with the length of the bytecode (e.g. java_lang_String_3322.bytes). If one of these files exists, we
know it contains the appropriate modified bytecode created on a previous run.
The cache is for types that are *only* getting reflection interception done, not for types touching anything reloadable.
- Since:
- 0.5.0
|
Method Summary |
static byte[] |
rewrite(TypeRegistry typeRegistry,
byte[] bytes)
|
static byte[] |
rewrite(TypeRegistry typeRegistry,
byte[] bytes,
boolean skipReferencesCheck)
Rewrite regular operations on reloadable types and any reflective calls. |
static byte[] |
rewriteUsingCache(java.lang.String slashedClassName,
TypeRegistry typeRegistry,
byte[] bytes)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MethodInvokerRewriter
public MethodInvokerRewriter()
rewrite
public static byte[] rewrite(TypeRegistry typeRegistry,
byte[] bytes,
boolean skipReferencesCheck)
- Rewrite regular operations on reloadable types and any reflective calls.
Note: no caching is done here (the cache is not read or written to)
- Parameters:
typeRegistry - the registry for which the rewriting is being done.bytes - the bytes for the type to modify.skipReferencesCheck - do we need to do a quick check to see if there is anything worth rewriting?
- Returns:
- the modified bytes.
rewrite
public static byte[] rewrite(TypeRegistry typeRegistry,
byte[] bytes)
rewriteUsingCache
public static byte[] rewriteUsingCache(java.lang.String slashedClassName,
TypeRegistry typeRegistry,
byte[] bytes)