Richard, The 1.1-beta-1 release that just came out should have this bug fix in it.
James -----Original Message----- From: James Carman [mailto:[EMAIL PROTECTED] Sent: Thursday, April 28, 2005 2:11 PM To: [email protected] Subject: RE: RegistryShutdownListener This is fixed (see HIVEMIND-103) in the current version of the code (CVS HEAD). We haven't done a release which contains this yet. -----Original Message----- From: Hensley, Richard [mailto:[EMAIL PROTECTED] Sent: Thursday, April 28, 2005 1:59 PM To: [email protected] Subject: RegistryShutdownListener I found the following documentation which seems to imply that if an class implements the RegistryShutdownListener, the instance will be notified when the registry shutsdown. "A core service implementation may also implement the RegistryShutdownListener interface. When a Registry is shutdown, the registryDidShutdown() method is invoked on all services (and many other objects, such as proxies). The order in which these notifications occur is not defined. A service may release any resources it may hold at this time. It should not invoke methods on other service interfaces." However, I'm finding that my registryDidShutdown() method is only called if I add an <event-listener ...> to my configuration. Am I missing something? I'm using hivemind-1.1-alpha3 Here is a test that shows the problem. File shutdown-test.xml: <?xml version="1.0"?> <module id="test" version="1.0.0" package="org.apache.hivemind.test.registry"> <service-point id="Works" interface="MyInterface"> <invoke-factory service-id="hivemind.BuilderFactory"> <construct class="MyClass"> <event-listener service-id="hivemind.ShutdownCoordinator" /> </construct> </invoke-factory> </service-point> <service-point id="Broken" interface="MyInterface"> <invoke-factory service-id="hivemind.BuilderFactory"> <construct class="MyClass"> </construct> </invoke-factory> </service-point> </module> File: MyInterface.java package org.apache.hivemind.test.registry; public interface MyInterface { public void method(); } File: MyClass.java package org.apache.hivemind.test.registry; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hivemind.events.RegistryShutdownListener; public class MyClass implements MyInterface, RegistryShutdownListener { private static final Log LOG = LogFactory.getLog(MyClass.class); public void method() { } public void registryDidShutdown() { LOG.debug("MyClass.registryDidShutdown"); } } File: ShutdownTest.java package org.apache.hivemind.test.registry; import org.apache.hivemind.Registry; import org.apache.hivemind.test.HiveMindTestCase; public class ShutdownTest extends HiveMindTestCase { public void testWorks() throws Exception { interceptLogging(MyClass.class.getName()); Registry r = buildFrameworkRegistry("shutdown-test.xml"); MyInterface m = (MyInterface) r.getService("test.Works", MyInterface.class); m.method(); r.shutdown(); assertLoggedMessage("MyClass.registryDidShutdown"); } public void testTestClass() { MyClass tc = new MyClass(); interceptLogging(MyClass.class.getName()); tc.registryDidShutdown(); assertLoggedMessage("MyClass.registryDidShutdown"); } public void testBroken() throws Exception { interceptLogging(MyClass.class.getName()); Registry r = buildFrameworkRegistry("shutdown-test.xml"); MyInterface m = (MyInterface) r.getService("test.Broken", MyInterface.class); m.method(); r.shutdown(); assertLoggedMessage("MyClass.registryDidShutdown"); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
