1 // Copyright 2004, 2005 The Apache Software Foundation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package org.apache.hivemind.events; 16 17 import java.util.EventListener; 18 19 /** 20 * Lifecycle interface that may be implemented by objects 21 * that need to know when the {@link org.apache.hivemind.Registry} 22 * has shutdown. Typically, this is implemented by core service implementations 23 * (as well as many proxies created by HiveMind). 24 * 25 * <p> 26 * A core service implementation that implements this interface will 27 * automatically be registered for notifications (exception: not if the service 28 * uses the threaded service model). 29 * 30 * <p>Using this notification is 31 * preferrable to implementing a <code>finalize()</code> since it will be invoked 32 * at a known time. 33 * 34 * <p> 35 * The order in which listeners will be invoked is 36 * not well known. In the future, some form of dependency system may 37 * be instituted. 38 * 39 * 40 * @author Howard Lewis Ship 41 */ 42 public interface RegistryShutdownListener extends EventListener 43 { 44 /** 45 * Invoked when a service is being shutdown, and should release any external resources. 46 * A service should <em>not</em> attempt to use any resources or configurations, doing 47 * so may result in a runtime exception. 48 */ 49 public void registryDidShutdown(); 50 } 51