001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.xbean.kernel;
018    
019    import java.util.Set;
020    
021    /**
022     * The StopStrategy interface is used to assist the kernel in determining how to handle problems that occur while
023     * stoping a service.
024     *
025     * @author Dain Sundstrom
026     * @version $Id$
027     * @since 2.0
028     */
029    public interface StopStrategy {
030        /**
031         * Determines if the kernel should wait for the unsatified conditions to be satisfied.
032         *
033         * @param serviceName the name of the service that has the unsatisfied condtions
034         * @param conditions the unsatisfied condtions
035         * @return true if the kernel should wait for the conditions to be satisfied; false if the strategy would like
036         *         silently leave the service in the stopping state
037         * @throws UnsatisfiedConditionsException the the strategy would like to leave the service in the stopping state
038         * and throw an exception the caller
039         * @throws ForcedStopException if the strategy would like to ignore the unsatisfied conditions and continue to
040         * destroy the service
041         */
042        boolean waitForUnsatisfiedConditions(ServiceName serviceName, Set conditions) throws UnsatisfiedConditionsException, ForcedStopException;
043    }