hlship 2003/10/02 11:42:06 Modified: hivemind/framework/src/test/hivemind/test/services/impl RunnableImpl.java hivemind/framework/src/test/hivemind/test/services TestThreadedModel.java hivemind/framework/src/java/org/apache/commons/hivemind/impl AbstractServiceModelImpl.java ThreadedServiceModel.java hivemind/framework/src/java/org/apache/commons/hivemind HiveMindMessages.properties hivemind/xdocs services.xml Added: hivemind/framework/src/test/hivemind/test/services/impl RegistryShutdownStringHolderImpl.java DiscardableStringHolderImpl.java hivemind/framework/src/test/hivemind/test/services ThreadedRegistryShutdown.xml ThreadedDiscardable.xml hivemind/framework/src/java/org/apache/commons/hivemind Discardable.java Log: Add Discardable interface, used by the threaded service model. Revision Changes Path 1.2 +58 -1 jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/services/impl/RunnableImpl.java Index: RunnableImpl.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/services/impl/RunnableImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- RunnableImpl.java 1 Oct 2003 20:43:21 -0000 1.1 +++ RunnableImpl.java 2 Oct 2003 18:42:06 -0000 1.2 @@ -1,3 +1,60 @@ +/* + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + package hivemind.test.services.impl; import org.apache.commons.hivemind.RegistryShutdownListener; 1.1 jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/services/impl/RegistryShutdownStringHolderImpl.java Index: RegistryShutdownStringHolderImpl.java =================================================================== /* * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package hivemind.test.services.impl; import hivemind.test.services.TestThreadedModel; import org.apache.commons.hivemind.RegistryShutdownListener; /** * Used to check that the threaded model does <em>not</em> * invoke the registryDidShutdown() method. * * @author Howard Lewis Ship * @version $Id: RegistryShutdownStringHolderImpl.java,v 1.1 2003/10/02 18:42:06 hlship Exp $ */ public class RegistryShutdownStringHolderImpl extends StringHolderImpl implements RegistryShutdownListener { public void registryDidShutdown() { TestThreadedModel._didShutdown = true; } } 1.1 jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/services/impl/DiscardableStringHolderImpl.java Index: DiscardableStringHolderImpl.java =================================================================== /* * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package hivemind.test.services.impl; import org.apache.commons.hivemind.Discardable; import org.apache.commons.logging.Log; /** * Used to test that the threaded service model invokes this method * as a service instance is discarded. * * @author Howard Lewis Ship * @version $Id: DiscardableStringHolderImpl.java,v 1.1 2003/10/02 18:42:06 hlship Exp $ */ public class DiscardableStringHolderImpl extends StringHolderImpl implements Discardable { private Log _log; public void threadDidDiscardService() { _log.info("threadDidDiscardService() has been invoked."); } public void setLog(Log log) { _log = log; } } 1.4 +50 -0 jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/services/TestThreadedModel.java Index: TestThreadedModel.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/services/TestThreadedModel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestThreadedModel.java 22 Sep 2003 20:06:00 -0000 1.3 +++ TestThreadedModel.java 2 Oct 2003 18:42:06 -0000 1.4 @@ -184,4 +184,54 @@ "END getValue() [fred]" }); } + // Set by RegistryShutdownStringHolderImpl to true (except it doesn't, + // because the registryDidShutdown() method doesn't get invoked. + + public static boolean _didShutdown = false; + + protected void tearDown() + { + _didShutdown = false; + } + + public void testIgnoreRegistyShutdownListener() throws Exception + { + Registry r = buildFrameworkRegistry("ThreadedRegistryShutdown.xml"); + + StringHolder h = + (StringHolder) r.getService( + "hivemind.test.services.ThreadedRegistryShutdown", + StringHolder.class); + + interceptLogging(); + + h.setValue("foo"); + + assertLoggedMessage("Core implementation of service hivemind.test.services.ThreadedRegistryShutdown implements the RegistryCleanupListener interface, which is not supported by the threaded service model."); + + r.shutdown(); + + assertEquals(false, _didShutdown); + } + + public void testDiscardable() throws Exception + { + Registry r = buildFrameworkRegistry("ThreadedDiscardable.xml"); + + StringHolder h = + (StringHolder) r.getService( + "hivemind.test.services.ThreadedDiscardable", + StringHolder.class); + + h.setValue("bar"); + + ThreadEventNotifier n = (ThreadEventNotifier)r.getService("hivemind.ThreadEventNotifier", + ThreadEventNotifier.class); + + interceptLogging("hivemind"); + + n.fireThreadCleanup(); + + assertLoggedMessage("threadDidDiscardService() has been invoked."); + } } 1.1 jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/services/ThreadedRegistryShutdown.xml Index: ThreadedRegistryShutdown.xml =================================================================== <?xml version="1.0" encoding="UTF-8"?> <!-- $Id: ThreadedRegistryShutdown.xml,v 1.1 2003/10/02 18:42:06 hlship Exp $ --> <module id="hivemind.test.services" version="1.0.0"> <service-point id="ThreadedRegistryShutdown" interface="hivemind.test.services.StringHolder" model="threaded"> <create-instance class="hivemind.test.services.impl.RegistryShutdownStringHolderImpl"/> </service-point> </module> 1.1 jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/services/ThreadedDiscardable.xml Index: ThreadedDiscardable.xml =================================================================== <?xml version="1.0" encoding="UTF-8"?> <!-- $Id: ThreadedDiscardable.xml,v 1.1 2003/10/02 18:42:06 hlship Exp $ --> <module id="hivemind.test.services" version="1.0.0"> <service-point id="ThreadedDiscardable" interface="hivemind.test.services.StringHolder" model="threaded"> <invoke-factory service-id="hivemind.BuilderFactory"> <construct class="hivemind.test.services.impl.DiscardableStringHolderImpl" log-property="log"/> </invoke-factory> </service-point> </module> 1.3 +4 -5 jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/commons/hivemind/impl/AbstractServiceModelImpl.java Index: AbstractServiceModelImpl.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/commons/hivemind/impl/AbstractServiceModelImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AbstractServiceModelImpl.java 1 Oct 2003 20:43:21 -0000 1.2 +++ AbstractServiceModelImpl.java 2 Oct 2003 18:42:06 -0000 1.3 @@ -132,6 +132,10 @@ */ protected Object constructCoreServiceImplementation() { + if (LOG.isDebugEnabled()) + LOG.debug( + "Constructing core instance for service " + _servicePoint.getExtensionPointId()); + Class serviceType = _servicePoint.getServiceInterface(); ServiceImplementationConstructor constructor = _servicePoint.getServiceConstructor(); Object result = constructor.constructCoreServiceImplementation(); @@ -212,11 +216,6 @@ { try { - if (LOG.isDebugEnabled()) - LOG.debug( - "Constructing core instance for service " - + _servicePoint.getExtensionPointId()); - Object core = constructCoreServiceImplementation(); Object intercepted = addInterceptors(core); 1.4 +61 -16 jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/commons/hivemind/impl/ThreadedServiceModel.java Index: ThreadedServiceModel.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/commons/hivemind/impl/ThreadedServiceModel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ThreadedServiceModel.java 1 Oct 2003 20:43:21 -0000 1.3 +++ ThreadedServiceModel.java 2 Oct 2003 18:42:06 -0000 1.4 @@ -61,12 +61,16 @@ import java.lang.reflect.Modifier; import org.apache.commons.hivemind.ApplicationRuntimeException; +import org.apache.commons.hivemind.Discardable; +import org.apache.commons.hivemind.HiveMind; import org.apache.commons.hivemind.Registry; import org.apache.commons.hivemind.RegistryShutdownListener; import org.apache.commons.hivemind.service.BodyBuilder; import org.apache.commons.hivemind.service.ClassFab; import org.apache.commons.hivemind.service.ThreadCleanupListener; import org.apache.commons.hivemind.service.ThreadEventNotifier; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * Like @@ -81,6 +85,8 @@ */ public final class ThreadedServiceModel extends AbstractServiceModelImpl { + private static final Log LOG = LogFactory.getLog(ThreadedServiceModel.class); + /** * Name of a method in the deferred proxy that is used to obtain * the constructed service. @@ -98,11 +104,30 @@ class CleanupListener implements ThreadCleanupListener { + // The core, wrapped by any interceptors + private Object _service; + // The core itself + private Object _core; + + CleanupListener(Object service, Object core) + { + _service = service; + _core = core; + } + public void threadDidCleanup() { + // Orhpan this object _notifier.removeThreadCleanupListener(this); discardActiveService(); + + if (_core instanceof Discardable) + { + Discardable d = (Discardable) _core; + + d.threadDidDiscardService(); + } } } @@ -258,25 +283,45 @@ private Object constructServiceForCurrentThread() { - // Note: don't call constructServiceImplementation since that discards the - // service instance constructor and interceptor contributions; we need - // to be able to build new instances of the service again and again. - - Object result = constructNewServiceImplementation(); - if (_notifier == null) + try { - Registry registry = getServicePoint().getModule().getRegistry(); - _notifier = - (ThreadEventNotifier) registry.getService( - "hivemind.ThreadEventNotifier", - ThreadEventNotifier.class); - } + Object core = constructCoreServiceImplementation(); + Object result = addInterceptors(core); - _notifier.addThreadCleanupListener(new CleanupListener()); - _activeService.set(result); + initializeCoreServiceImplementation(core, result); - return result; + if (core instanceof RegistryShutdownListener) + LOG.error( + HiveMind.format( + "ThreadedServiceModel.registry-cleanup-ignored", + getServicePoint().getExtensionPointId())); + + if (_notifier == null) + { + Registry registry = getServicePoint().getModule().getRegistry(); + + _notifier = + (ThreadEventNotifier) registry.getService( + "hivemind.ThreadEventNotifier", + ThreadEventNotifier.class); + } + + _notifier.addThreadCleanupListener(new CleanupListener(result, core)); + + _activeService.set(result); + + return result; + } + catch (Exception ex) + { + throw new ApplicationRuntimeException( + HiveMind.format( + "ServiceExtensionPoint.unable-to-construct-service", + getServicePoint().getExtensionPointId(), + ex.getMessage()), + ex); + } } private void discardActiveService() 1.5 +3 -1 jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/commons/hivemind/HiveMindMessages.properties Index: HiveMindMessages.properties =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/commons/hivemind/HiveMindMessages.properties,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- HiveMindMessages.properties 1 Oct 2003 20:43:23 -0000 1.4 +++ HiveMindMessages.properties 2 Oct 2003 18:42:06 -0000 1.5 @@ -79,6 +79,8 @@ ShutdownCoordinator.failure=Unable to shutdown {0}: {1} +ThreadedServiceModel.registry-cleanup-ignored=Core implementation of service {0} implements the RegistryCleanupListener interface, which is not supported by the threaded service model. + # javassist package AbstractServiceExtensionPoint.error-instantiating-interceptor=Service interceptor factory {0} failed to create {1} interceptor for service {2} as class {3}: {4} 1.1 jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/commons/hivemind/Discardable.java Index: Discardable.java =================================================================== /* * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.commons.hivemind; /** * Implemented by a core service implementationsthat require notification when they are * discarded. This interface is only used by the * [EMAIL PROTECTED] org.apache.commons.hivemind.impl.ThreadedServiceModel threaded service model}, * which creates a service for a short period, then discards it when notified * by the [EMAIL PROTECTED] org.apache.commons.hivemind.service.ThreadEventNotifier}. * * <p> * The service instance will be discarded regardless; this interface allows * the core service implementation to know immediately when this happens, * so that it can release any acquired resources. * * @author Howard Lewis Ship * @version $Id: Discardable.java,v 1.1 2003/10/02 18:42:06 hlship Exp $ */ public interface Discardable { /** * Invoked when a service is being discarded. */ public void threadDidDiscardService(); } 1.28 +15 -7 jakarta-commons-sandbox/hivemind/xdocs/services.xml Index: services.xml =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/xdocs/services.xml,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- services.xml 1 Oct 2003 20:43:21 -0000 1.27 +++ services.xml 2 Oct 2003 18:42:06 -0000 1.28 @@ -340,20 +340,26 @@ <section name="Threaded Service Model"> <p> -In general, singleton services should be sufficient. In some cases, +In general, singleton services (using the deferred service model) should be sufficient. In some cases, the service may need to keep some specific state. State and multithreading don't mix, so the -<b>threaded</b> service model constructs, as needed, a service implementation -for the current thread. Once constructed, the service implementation stays bound to the thread until it is discarded. +<b>threaded</b> service model constructs, as needed, a service instance +for the current thread. Once constructed, the service instance stays bound to the thread until it is discarded. </p> <p> -The service implementation is discarded when notified to cleanup; this is controlled by the +The service instance is discarded when notified to cleanup; this is controlled by the <a href="&hivemind-registry;#service:hivemind.ThreadEventNotifier">hivemind.ThreadEventNotifier</a> service. If your application has any threaded services, you are responsible for invoking the <code>fireThreadCleanup()</code> method of the service. </p> <p> +A core implementation may implement the +<a href="&apiroot;/Discardable.html">Discardable</a> interface. If so, it will receive +a notification when the service instance is discarded. +</p> + +<p> For example, a servlet application may want to add the following: </p> @@ -410,9 +416,11 @@ </p> <p> -<b>Note:</b> the threaded service model does <b>not</b> registry services for Registry shutdown notification. +The threaded service model does <b>not</b> registry services for Registry shutdown notification. It doesn't matter if the core service implementation implements the RegistryShutdownListener -interface or not. +interface or not. Instead, the core service implementation may implement the +<a href="&apiroot;/Discardable.html">Discardable</a> interface, +to be informed when a service bound to a thread is discarded. </p> <p>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]