Interface LifeCycle<T extends LifeCycle>

Type Parameters:
T - The type
All Superinterfaces:
AutoCloseable, Closeable
All Known Subinterfaces:
ApplicationContext, ApplicationContextLifeCycle<T>, BeanContext, ConfigurableApplicationContext, ConfigurableBeanContext, EmbeddedApplication<T>, EmbeddedServer, Environment, HttpClient, InitializableBeanContext, JdkHttpClient, NettyEmbeddedServer, StreamingHttpClient
All Known Implementing Classes:
AbstractConcurrentCustomScope, DefaultApplicationContext, DefaultBeanContext, DefaultEnvironment, DefaultHttpClient, DefaultJdkHttpClient, DefaultWatchThread, DeleteEndpointRouteBuilder, MacOsWatchThread, MessagingApplication, NettyHttpServer, ReadEndpointRouteBuilder, RefreshScope, WriteEndpointRouteBuilder

public interface LifeCycle<T extends LifeCycle> extends Closeable, 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
Author:
Graeme Rocher
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Delegates to stop().
    boolean
     
    default T
    Refreshes the current life cycle object.
    default T
    Starts the lifecyle component.
    default T
    Stops the life cycle component.
  • Method Details

    • 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 to stop().
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • refresh

      @NonNull default T refresh()
      Refreshes the current life cycle object. Effectively this calls stop() followed by start().
      Returns:
      This lifecycle component