updated javadoc for server-specific LoadTimeWeavers
This commit is contained in:
parent
f800a026cb
commit
2c199cf190
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2010 the original author or authors.
|
* Copyright 2002-2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -20,6 +20,7 @@ import java.lang.instrument.ClassFileTransformer;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||||
import org.springframework.beans.factory.DisposableBean;
|
import org.springframework.beans.factory.DisposableBean;
|
||||||
import org.springframework.instrument.InstrumentationSavingAgent;
|
import org.springframework.instrument.InstrumentationSavingAgent;
|
||||||
|
|
@ -40,13 +41,14 @@ import org.springframework.instrument.classloading.websphere.WebSphereLoadTimeWe
|
||||||
* "<code>loadTimeWeaver</code>"; the most convenient way to achieve this is
|
* "<code>loadTimeWeaver</code>"; the most convenient way to achieve this is
|
||||||
* Spring's <code><context:load-time-weaver></code> XML tag.
|
* Spring's <code><context:load-time-weaver></code> XML tag.
|
||||||
*
|
*
|
||||||
* <p>This class implements a runtime environment check for obtaining the
|
* <p>This class implements a runtime environment check for obtaining
|
||||||
* appropriate weaver implementation: As of Spring 2.5, it detects Sun's
|
* the appropriate weaver implementation: As of Spring 3.1, it detects
|
||||||
* GlassFish, Oracle's OC4J, BEA's WebLogic 10,
|
* Oracle WebLogic 10, Oracle OC4J 10, GlassFish 3, JBoss AS 5, 6 and 7,
|
||||||
* {@link InstrumentationSavingAgent Spring's VM agent} and any
|
* IBM WebSphere 7 and 8, {@link InstrumentationSavingAgent Spring's VM agent}
|
||||||
* {@link ClassLoader} supported by Spring's {@link ReflectiveLoadTimeWeaver}
|
* and any {@link ClassLoader} supported by Spring's {@link ReflectiveLoadTimeWeaver}
|
||||||
* (for example the
|
* (for example the
|
||||||
* {@link org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader}).
|
* {@link org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader}
|
||||||
|
* for Tomcat 5, 6 and 7).
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @author Ramnivas Laddad
|
* @author Ramnivas Laddad
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2011 the original author or authors.
|
* Copyright 2002-2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -22,6 +22,7 @@ import java.lang.instrument.ClassFileTransformer;
|
||||||
* Simple interface used for handling the different JBoss class loader adapters.
|
* Simple interface used for handling the different JBoss class loader adapters.
|
||||||
*
|
*
|
||||||
* @author Costin Leau
|
* @author Costin Leau
|
||||||
|
* @since 3.1
|
||||||
*/
|
*/
|
||||||
interface JBossClassLoaderAdapter {
|
interface JBossClassLoaderAdapter {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2009 the original author or authors.
|
* Copyright 2002-2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -25,15 +25,13 @@ import org.springframework.util.ClassUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link LoadTimeWeaver} implementation for JBoss's instrumentable ClassLoader.
|
* {@link LoadTimeWeaver} implementation for JBoss's instrumentable ClassLoader.
|
||||||
* Currently supports JBoss 5, 6 and 7 (since Spring 3.1).
|
* Autodetects the specific JBoss version at runtime: currently supports
|
||||||
|
* JBoss AS 5, 6 and 7 (as of Spring 3.1).
|
||||||
*
|
*
|
||||||
* <p><b>NOTE:</b> Requires JBoss AS version 5.0.0 or higher.
|
* <p><b>NOTE:</b> On JBoss 6.0, to avoid the container loading the classes before
|
||||||
* <p><b>NOTE:</b> On JBoss 6.0.0, to avoid the container loading the classes before
|
|
||||||
* the application actually starts, one needs to add <tt>WEB-INF/jboss-scanning.xml</tt>
|
* the application actually starts, one needs to add <tt>WEB-INF/jboss-scanning.xml</tt>
|
||||||
* to her archive with the following content:
|
* to her archive with the following content:
|
||||||
* <pre>
|
* <pre><scanning xmlns="urn:jboss:scanning:1.0"/></pre>
|
||||||
* <scanning xmlns="urn:jboss:scanning:1.0"/>
|
|
||||||
* </pre>
|
|
||||||
*
|
*
|
||||||
* <p>Thanks to Ales Justin and Marius Bogoevici for the initial prototype.</p>
|
* <p>Thanks to Ales Justin and Marius Bogoevici for the initial prototype.</p>
|
||||||
*
|
*
|
||||||
|
|
@ -44,6 +42,7 @@ public class JBossLoadTimeWeaver implements LoadTimeWeaver {
|
||||||
|
|
||||||
private final JBossClassLoaderAdapter adapter;
|
private final JBossClassLoaderAdapter adapter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance of the {@link JBossLoadTimeWeaver} class using
|
* Create a new instance of the {@link JBossLoadTimeWeaver} class using
|
||||||
* the default {@link ClassLoader class loader}.
|
* the default {@link ClassLoader class loader}.
|
||||||
|
|
@ -66,14 +65,17 @@ public class JBossLoadTimeWeaver implements LoadTimeWeaver {
|
||||||
if (loaderClassName.startsWith("org.jboss.classloader")) {
|
if (loaderClassName.startsWith("org.jboss.classloader")) {
|
||||||
// JBoss AS 5 or JBoss AS 6
|
// JBoss AS 5 or JBoss AS 6
|
||||||
this.adapter = new JBossMCAdapter(classLoader);
|
this.adapter = new JBossMCAdapter(classLoader);
|
||||||
} else if (loaderClassName.startsWith("org.jboss.modules")) {
|
}
|
||||||
|
else if (loaderClassName.startsWith("org.jboss.modules")) {
|
||||||
// JBoss AS 7
|
// JBoss AS 7
|
||||||
this.adapter = new JBossModulesAdapter(classLoader);
|
this.adapter = new JBossModulesAdapter(classLoader);
|
||||||
} else {
|
}
|
||||||
throw new IllegalArgumentException("Unexpected classloader type: " + loaderClassName);
|
else {
|
||||||
|
throw new IllegalArgumentException("Unexpected ClassLoader type: " + loaderClassName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addTransformer(ClassFileTransformer transformer) {
|
public void addTransformer(ClassFileTransformer transformer) {
|
||||||
this.adapter.addTransformer(transformer);
|
this.adapter.addTransformer(transformer);
|
||||||
}
|
}
|
||||||
|
|
@ -85,4 +87,5 @@ public class JBossLoadTimeWeaver implements LoadTimeWeaver {
|
||||||
public ClassLoader getThrowawayClassLoader() {
|
public ClassLoader getThrowawayClassLoader() {
|
||||||
return new SimpleThrowawayClassLoader(getInstrumentableClassLoader());
|
return new SimpleThrowawayClassLoader(getInstrumentableClassLoader());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2006-2009 the original author or authors.
|
* Copyright 2002-2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -28,6 +28,7 @@ import org.springframework.util.ReflectionUtils;
|
||||||
* through reflection) for load time weaving.
|
* through reflection) for load time weaving.
|
||||||
*
|
*
|
||||||
* @author Costin Leau
|
* @author Costin Leau
|
||||||
|
* @since 3.1
|
||||||
*/
|
*/
|
||||||
class JBossMCAdapter implements JBossClassLoaderAdapter {
|
class JBossMCAdapter implements JBossClassLoaderAdapter {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2006-2009 the original author or authors.
|
* Copyright 2002-2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -28,6 +28,7 @@ import java.security.ProtectionDomain;
|
||||||
* being used.
|
* being used.
|
||||||
*
|
*
|
||||||
* @author Costin Leau
|
* @author Costin Leau
|
||||||
|
* @since 3.1
|
||||||
*/
|
*/
|
||||||
class JBossMCTranslatorAdapter implements InvocationHandler {
|
class JBossMCTranslatorAdapter implements InvocationHandler {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2011 the original author or authors.
|
* Copyright 2002-2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -24,9 +24,10 @@ import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JBoss 7 Adapter.
|
* JBoss 7 adapter.
|
||||||
*
|
*
|
||||||
* @author Costin Leau
|
* @author Costin Leau
|
||||||
|
* @since 3.1
|
||||||
*/
|
*/
|
||||||
class JBossModulesAdapter implements JBossClassLoaderAdapter {
|
class JBossModulesAdapter implements JBossClassLoaderAdapter {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,8 @@ import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ClassUtils;
|
import org.springframework.util.ClassUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link LoadTimeWeaver} implementation for WebSphere instrumentable classloader.
|
* {@link LoadTimeWeaver} implementation for WebSphere's instrumentable ClassLoader.
|
||||||
*
|
* Compatible with WebSphere 7 as well as 8.
|
||||||
* <p><b>NOTE:</b> Requires WebSphere Application Server version 7.0.0 or higher.
|
|
||||||
*
|
*
|
||||||
* @author Costin Leau
|
* @author Costin Leau
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue