Merge "Add Mycilla code to odlguice"
[odlguice.git] / inject / inject / src / main / java / org / opendaylight / infrautils / inject / Lifecycle.java
1 /*
2  * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.infrautils.inject;
9
10 /**
11  * Something which can be {@link #init()}-ialized and {@link #destroy()}-d.
12  *
13  * <p>Annotated so that Dependency Injection Frameworks (whichever) automatically call these methods during wiring.
14  *
15  * @see AbstractLifecycle
16  *
17  * @author Michael Vorburger
18  */
19 public interface Lifecycle {
20
21     /**
22      * Initialize the object.
23      *
24      * @throws ModuleSetupRuntimeException if initialization failed
25      */
26     void init() throws ModuleSetupRuntimeException;
27
28     /**
29      * Destroy the object.
30      *
31      * @throws ModuleSetupRuntimeException if destruction failed
32      */
33     void destroy() throws ModuleSetupRuntimeException;
34
35     boolean isRunning();
36
37 }