Package io.micronaut.context
Interface LifeCycle<T extends LifeCycle>
-
- Type Parameters:
T
- The type
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- All Known Subinterfaces:
ApplicationContext
,ApplicationContextLifeCycle<T>
,BeanContext
,Environment
,InitializableBeanContext
- All Known Implementing Classes:
AbstractConcurrentCustomScope
,DefaultApplicationContext
,DefaultBeanContext
,DefaultEnvironment
public interface LifeCycle<T extends LifeCycle> extends java.io.Closeable, java.lang.AutoCloseable
A life cycle interface providing a start method and extending Closeable which provides a close() method for termination.Components can implement this interface
- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
close()
Delegates tostop()
.boolean
isRunning()
default T
refresh()
Refreshes the current life cycle object.default T
start()
Starts the lifecyle component.default T
stop()
Stops the life cycle component.
-
-
-
Method Detail
-
isRunning
boolean isRunning()
- Returns:
- Whether the component is running
-
start
@NonNull default T start()
Starts the lifecyle component.- Returns:
- This lifecycle component
-
stop
@NonNull default T stop()
Stops the life cycle component.- Returns:
- This lifecycle component
-
close
default void close()
Delegates tostop()
.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
refresh
@NonNull default T refresh()
- Returns:
- This lifecycle component
-
-