Interface LifecycleService


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

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

    • isRunning

      boolean isRunning()
      Checks whether 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