com.hazelcast.core

## Interface LifecycleService

- All Known Implementing Classes:
    LifecycleServiceImpl, TerminatedLifecycleService

      public interface LifecycleService

  LifecycleService allows you to shutdown, terminate, and listen to `LifecycleEvent`s on HazelcastInstance.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `addLifecycleListener(LifecycleListener lifecycleListener)` Add a listener object to listen for lifecycle events.
    `boolean` | `isRunning()` Checks whether or not the instance is running.
    `boolean` | `removeLifecycleListener(String registrationId)` Removes a lifecycle listener.
    `void` | `shutdown()` Gracefully shuts down HazelcastInstance.
    `void` | `terminate()` Terminate HazelcastInstance ungracefully.

- - ### Method Detail

    - #### isRunning

          boolean isRunning()

      Checks whether or not the instance is running.
      Returns:
        `true`, if instance is active and running, `false` otherwise

    - #### shutdown

          void shutdown()

      Gracefully shuts down HazelcastInstance. It's different from `terminate()` in that it waits for partition operations to complete.

    - #### terminate

          void terminate()

      Terminate HazelcastInstance ungracefully. Does not wait for partition operations, forces immediate shutdown. Use `shutdown()` for graceful shutdown.

    - #### addLifecycleListener

          String addLifecycleListener(LifecycleListener lifecycleListener)

      Add a listener object to listen for lifecycle events.
      Parameters:
        `lifecycleListener` - the listener object
      Returns:
        the listener ID

    - #### removeLifecycleListener

          boolean removeLifecycleListener(String registrationId)

      Removes a lifecycle listener.
      Parameters:
        `registrationId` - the listener ID returned by `addLifecycleListener(LifecycleListener)`
      Returns:
        true if the listener is removed successfully, false otherwise

Copyright © 2019. All rights reserved.