[jboss-cvs] JBossAS SVN: r86897 - branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 7 04:16:42 EDT 2009
Author: emuckenhuber
Date: 2009-04-07 04:16:42 -0400 (Tue, 07 Apr 2009)
New Revision: 86897
Modified:
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
Log:
[JBAS-6694] cleanup aop proxies on reload
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java 2009-04-07 06:57:19 UTC (rev 86896)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java 2009-04-07 08:16:42 UTC (rev 86897)
@@ -23,6 +23,8 @@
import java.io.IOException;
import java.lang.annotation.Annotation;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
@@ -37,6 +39,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.jboss.aop.AspectManager;
import org.jboss.aop.Dispatcher;
import org.jboss.aop.advice.Interceptor;
import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
@@ -158,6 +161,9 @@
private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
/** ManagedObjectFactory used for platform mbean ManagedObjects */
ManagedObjectFactory managedObjFactory = ManagedObjectFactory.getInstance();
+
+ /** FIXME A cl used to reference AOP proxies. */
+ private ClassLoader proxyLoader;
/** The created remoting targets. */
private List<String> remotingTargets = new ArrayList<String>();
@@ -181,13 +187,14 @@
public void start()
{
- // Nothing
+ proxyLoader = new URLClassLoader(new URL[0], getClass().getClassLoader());
}
public void stop()
{
// Cleanup on stop
release();
+ proxyLoader = null;
}
public boolean load()
@@ -315,14 +322,23 @@
this.lastModified.clear();
this.rootDeployments.clear();
+ cleanupProxies();
+
// Unregister targets
for(String target : remotingTargets)
Dispatcher.singleton.unregisterTarget(target);
-
+
log.debug("Unregistered " + remotingTargets.size() + " targets.");
- this.remotingTargets.clear();
+ this.remotingTargets.clear();
}
+ protected void cleanupProxies()
+ {
+ // FIXME this is a hack
+ AspectManager.instance().unregisterClassLoader(proxyLoader);
+ proxyLoader = new URLClassLoader(new URL[0], getClass().getClassLoader());
+ }
+
protected void loadProfiles(boolean trace)
{
log.debug("reloading profiles: "+ this.ps.getActiveProfileKeys());
@@ -1357,7 +1373,6 @@
if (dispatcher == null)
throw new IllegalArgumentException("Missing RuntimeComponentDispatcher.");
- ClassLoader loader = getClass().getClassLoader();
ArrayList<Interceptor> interceptors = new ArrayList<Interceptor>();
interceptors.add(SecurityClientInterceptor.singleton);
interceptors.add(MergeMetaDataInterceptor.singleton);
@@ -1371,12 +1386,11 @@
Class<?>[] ifaces = {ManagedProperty.class};
Dispatcher.singleton.registerTarget(dispatchName, delegate);
ManagedProperty proxy = (ManagedProperty) Remoting.createRemoteProxy(dispatchName,
- loader, ifaces, locator, interceptors, "ProfileService");
+ proxyLoader, ifaces, locator, interceptors, "ProfileService");
remotingTargets.add(dispatchName);
return proxy;
}
-
/**
* Create ManagedOperation wrapper to intercept
* its invocation, pushing the actual invocation
@@ -1400,7 +1414,6 @@
protected Set<ManagedOperation> createOperationProxies(Set<ManagedOperation> ops, Object componentName)
throws Exception
{
- ClassLoader loader = getClass().getClassLoader();
ArrayList<Interceptor> interceptors = new ArrayList<Interceptor>();
interceptors.add(SecurityClientInterceptor.singleton);
interceptors.add(MergeMetaDataInterceptor.singleton);
@@ -1415,7 +1428,7 @@
String dispatchName = "ProfileService.ManagedOperation@"+System.identityHashCode(op);
Dispatcher.singleton.registerTarget(dispatchName, new ManagedOperationDelegate(op, componentName));
ManagedOperation opProxy = (ManagedOperation) Remoting.createRemoteProxy(dispatchName,
- loader, ifaces, locator, interceptors, "ProfileService");
+ proxyLoader, ifaces, locator, interceptors, "ProfileService");
remotingTargets.add(dispatchName);
opProxies.add(opProxy);
}
More information about the jboss-cvs-commits
mailing list