Bugs item #763378, was opened at 2003-06-30 20:36 Message generated for change (Settings changed) made by juhalindfors You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=763378&group_id=22866
Category: JBossMX >Group: v4.0 Status: Open >Resolution: Accepted Priority: 5 Submitted By: Rod Burgett (rodburgett) >Assigned to: Juha Lindfors (juhalindfors) Summary: housekeeping in mbean server module Initial Comment: The mbean server has no clean operation, the server is never emptied or released from the mbean server factory. This constitutes a resource leak if JBoss is started (and restarted) from within a single JVM process. Unfortunately, the JMX API does not include a shutdown method for the MBeanServer interface. So cleanup must be performed outside of the JMX API, and must involve casting an MBeanServer to a specific implementation. The strategy used by this patch is to add a shutdown method to the mbean registry and mbean server implementations. The registry shutdown method is exposed through JMX, so it may be called during JBoss shutdown processing. The registry has a reference to the mbean server, so registry.shutdown can cast the server to server impl and invoke the server shutdown method. This strategy might be improved by defining a new interface that extends MBeanServer, adding the shutdown method. Then the registry impl becomes coupled to the new interface, rather than the server implementation class. On the other hand, such a generalization might be viewed as overkill until new mbean server implementations are considered. An alternative solution could reverse the shutdown method calls, so the mbean server shutdown calls the registry shutdown. This solution would require adding the registry shutdown method to the MBeanRegistry interface. And would also require whatever method invokes the server shutdown to cast it's server reference to MBeanServerImpl. I prefer the first solution because it limits the casting, and specific implementation knowledge to the registry implementation, which is more closely related to the mbean server than most other JBoss classes. It should be noted that this patch will have no effect at run-time until code elsewhere is changed to invoke the registry shutdown method. Actual invocation of these new shutdown methods is left for another patch, aimed at improving cleanup in the JBoss ServerImpl class. These patch files implement the mbean server and registry cleanup strategy. The patch file for MBeanServerImpl.java adds a new shutdown method that releases the server from it's factory, shuts down the default loader repository and clears each listener proxy. Note that attempts to invoke the loader repository shutdown method will fail until the org.jboss.mx.loading patch, #763343, is applied. A second addition to the MBeanServerImpl class adds a shutdown method to the jmx operations supported by the mbean registry mbean. MBeanServerImpl creates this MBean dynamically. The patch file for BasicMBeanRegistry.java adds a shutdown method that shuts down it's mbean server, nulls some field references and clears it's domain map container. ---------------------------------------------------------------------- Comment By: Rod Burgett (rodburgett) Date: 2003-06-30 21:28 Message: Logged In: YES user_id=681969 Why null? Nulling the instance fields may not be required, but in this type of situation I think the GC needs all the help it can get. The MBean server/registry includes a reference to every registered mbean and each mbean holds a reference to the mbean server. Why restart? Our product embeds JBoss and permits bouncing the JBoss server without restarting the larger product. So, we can't rely on JVM destruction for memory and thread cleanup. ---------------------------------------------------------------------- Comment By: Juha Lindfors (juhalindfors) Date: 2003-06-30 21:01 Message: Logged In: YES user_id=175239 Why don't you simply unregister() all MBeans and MBeanServerFactory.releaseMBeanServer(server) and let GC do its job? What is your use case where you restart the kernel in-VM without restarting the JVM process? ---------------------------------------------------------------------- Comment By: Rod Burgett (rodburgett) Date: 2003-06-30 20:36 Message: Logged In: YES user_id=681969 adding the other diff file... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=763378&group_id=22866 ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ JBoss-Development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development