001// Copyright 2004, 2005 The Apache Software Foundation 002// 003// Licensed under the Apache License, Version 2.0 (the "License"); 004// you may not use this file except in compliance with the License. 005// You may obtain a copy of the License at 006// 007// http://www.apache.org/licenses/LICENSE-2.0 008// 009// Unless required by applicable law or agreed to in writing, software 010// distributed under the License is distributed on an "AS IS" BASIS, 011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012// See the License for the specific language governing permissions and 013// limitations under the License. 014 015package org.apache.hivemind.events; 016 017import java.util.EventListener; 018 019/** 020 * Lifecycle interface that may be implemented by objects 021 * that need to know when the {@link org.apache.hivemind.Registry} 022 * has shutdown. Typically, this is implemented by core service implementations 023 * (as well as many proxies created by HiveMind). 024 * 025 * <p> 026 * A core service implementation that implements this interface will 027 * automatically be registered for notifications (exception: not if the service 028 * uses the threaded service model). 029 * 030 * <p>Using this notification is 031 * preferrable to implementing a <code>finalize()</code> since it will be invoked 032 * at a known time. 033 * 034 * <p> 035 * The order in which listeners will be invoked is 036 * not well known. In the future, some form of dependency system may 037 * be instituted. 038 * 039 * 040 * @author Howard Lewis Ship 041 */ 042public interface RegistryShutdownListener extends EventListener 043{ 044 /** 045 * Invoked when a service is being shutdown, and should release any external resources. 046 * A service should <em>not</em> attempt to use any resources or configurations, doing 047 * so may result in a runtime exception. 048 */ 049 public void registryDidShutdown(); 050}