Top Description Fields Constructors Methods
org.glassfish.jaxb.runtime.v2.runtime.reflect.opt

pack-priv final Class Injector

extends Object
Class Inheritance
Imports
org.glassfish.jaxb.runtime.v2.runtime.reflect.Accessor, java.lang.ref.WeakReference, java.lang.reflect.Field, .InvocationTargetException, .Method, java.security.*, java.util.Arrays, .HashMap, .Map, .WeakHashMap, java.util.concurrent.locks.Lock, .ReentrantReadWriteLock, java.util.logging.Level, .Logger

A ClassLoader used to "inject" optimized accessor classes into the VM.

Its parent class loader needs to be set to the one that can see the user class.

Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
private final Map<String, Class<T>>
classes

Injected classes keyed by their names.

private static Method
private static Method
private static final Map<ClassLoader, WeakReference<Injector>>
private static final Lock
private static final ReentrantReadWriteLock
irwl

Injectors keyed by their parent ClassLoader.

private static final Lock
private final boolean
loadable

True if this injector is capable of injecting accessors.

private static final Logger
private final ClassLoader
private final Lock
r

private static Method
private final ReentrantReadWriteLock
private static Object
U

private final Lock
w

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static Class<T>
pack-priv static Class<T>
find(ClassLoader cl, String className)

Returns the already injected class, or null.

private Class<T>
find(String className)

private static Injector

Returns:

null if it fails.
get
(ClassLoader cl)

Gets or creates an for the given class loader.

private static Method
getMethod(final Class<?> c, final String methodname, final Class<?>... params)

pack-priv static Class<T>

Returns:

null if it fails to inject.
inject
(ClassLoader cl, String className, byte[] image)

Injects a new class into the given class loader.

private Class<T>
inject(String className, byte[] image)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classesback to summary
private final Map<String, Class<T>> classes

Injected classes keyed by their names.

defineClassback to summary
private static Method defineClass
findLoadedClassback to summary
private static Method findLoadedClass
injectorsback to summary
private static final Map<ClassLoader, WeakReference<Injector>> injectors
irback to summary
private static final Lock ir
irwlback to summary
private static final ReentrantReadWriteLock irwl

Injectors keyed by their parent ClassLoader. We only need one injector per one user class loader.

iwback to summary
private static final Lock iw
loadableback to summary
private final boolean loadable

True if this injector is capable of injecting accessors. False otherwise, which happens if this classloader can't see Accessor.

loggerback to summary
private static final Logger logger
parentback to summary
private final ClassLoader parent
rback to summary
private final Lock r
resolveClassback to summary
private static Method resolveClass
rwlback to summary
private final ReentrantReadWriteLock rwl
Uback to summary
private static Object U
wback to summary
private final Lock w

Constructor Detail

Injectorback to summary
private Injector(ClassLoader parent)

Method Detail

classForNamesback to summary
private static Class<T> classForNames(String... names) throws ClassNotFoundException
findback to summary
pack-priv static Class<T> find(ClassLoader cl, String className)

Returns the already injected class, or null.

findback to summary
private Class<T> find(String className)
getback to summary
private static Injector get(ClassLoader cl)

Gets or creates an for the given class loader.

Returns:Injector

null if it fails.

getMethodback to summary
private static Method getMethod(final Class<?> c, final String methodname, final Class<?>... params)
injectback to summary
pack-priv static Class<T> inject(ClassLoader cl, String className, byte[] image)

Injects a new class into the given class loader.

Returns:Class<T>

null if it fails to inject.

injectback to summary
private Class<T> inject(String className, byte[] image)
Annotations
@SuppressWarnings:LockAcquiredButNotSafelyReleased