org.infinispan.commons.marshall.jboss.DefaultContextClassResolver Maven / Gradle / Ivy
package org.infinispan.commons.marshall.jboss;
import java.lang.ref.WeakReference;
import org.jboss.marshalling.ContextClassResolver;
/**
* This class refines ContextClassLoader
to add a default class loader.
* The context class loader is only used when the default is null
.
*
* @author Dan Berindei
* @since 4.2
*/
public class DefaultContextClassResolver extends ContextClassResolver {
private WeakReference defaultClassLoader;
public DefaultContextClassResolver(ClassLoader defaultClassLoader) {
this.defaultClassLoader = new WeakReference(defaultClassLoader);
}
@Override
protected ClassLoader getClassLoader() {
ClassLoader defaultLoader = this.defaultClassLoader.get();
return defaultLoader != null ? defaultLoader : super.getClassLoader();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy