Interface LifecycleService


public interface LifecycleService
LifecycleService allows you to shutdown, terminate, and listen to LifecycleEvents on HazelcastInstance.
  • Method Summary

    Modifier and Type Method Description
    UUID addLifecycleListener​(LifecycleListener lifecycleListener)
    Add a listener object to listen for lifecycle events.
    boolean isRunning()
    Checks whether or not the instance is running.
    boolean removeLifecycleListener​(UUID registrationId)
    Removes a lifecycle listener.
    void shutdown()
    Gracefully shuts down HazelcastInstance.
    void terminate()
    Terminate HazelcastInstance ungracefully.
  • Method Details

    • 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

      @Nonnull UUID addLifecycleListener​(@Nonnull LifecycleListener lifecycleListener)
      Add a listener object to listen for lifecycle events.
      Parameters:
      lifecycleListener - the listener object
      Returns:
      the listener ID
    • removeLifecycleListener

      boolean removeLifecycleListener​(@Nonnull UUID registrationId)
      Removes a lifecycle listener.
      Parameters:
      registrationId - the listener ID returned by addLifecycleListener(LifecycleListener)
      Returns:
      true if the listener is removed successfully, false otherwise