1 /* 2 Copyright 2007 Ramon Servadei 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 package fulmine; 17 18 /** 19 * An object that has a life-cycle: 20 * 21 * <pre> 22 * created -> active -> destroyed 23 * </pre> 24 * 25 * When the object is created it is inactive. The {@link #start()} method 26 * activates it. The {@link #destroy()} method destroys it. 27 * 28 * @author Ramon Servadei 29 */ 30 public interface ILifeCycle extends IDestroyable 31 { 32 /** 33 * Activate (start) this object. This allocates system resources required 34 * for the object to operate. <u>This operation is idempotent.</u> 35 * <p> 36 * This method may throw a {@link RuntimeException} if it fails to activate 37 * the object. 38 */ 39 void start(); 40 41 /** 42 * Determine if this life-cycle object is active. 43 * 44 * @return <code>true</code> if the object is active 45 */ 46 boolean isActive(); 47 48 }