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;
016
017/**
018 * Implemented by a core service implementationsthat require notification when they are
019 * discarded. This interface is only used by the 
020 * {@link org.apache.hivemind.impl.servicemodel.ThreadedServiceModel threaded service model},
021 * which creates a service for a short period, then discards it when notified
022 * by the {@link org.apache.hivemind.service.ThreadEventNotifier}.
023 * 
024 * <p>
025 * The service instance will be discarded regardless; this interface allows
026 * the core service implementation to know immediately when this happens,
027 * so that it can release any acquired resources.
028 *
029 * @author Howard Lewis Ship
030 */
031public interface Discardable
032{
033    /**
034     * Invoked when a service is being discarded.
035     */
036    public void threadDidDiscardService();
037}