Package com.hazelcast.core
Interface LifecycleService
public interface LifecycleService
LifecycleService allows you to shut down, terminate, and listen to
LifecycleEvents
on HazelcastInstance.-
Method Summary
Modifier and TypeMethodDescriptionaddLifecycleListener(LifecycleListener lifecycleListener) Add a listener object to listen for lifecycle events.booleanChecks whether the instance is running.booleanremoveLifecycleListener(UUID registrationId) Removes a lifecycle listener.voidshutdown()Gracefully shuts down HazelcastInstance.voidTerminate HazelcastInstance ungracefully.
-
Method Details
-
isRunning
boolean isRunning()Checks whether the instance is running.- Returns:
true, if instance is active and running,falseotherwise
-
shutdown
void shutdown()Gracefully shuts down HazelcastInstance. It's different fromterminate()in that it waits for partition operations to complete. -
terminate
void terminate()Terminate HazelcastInstance ungracefully. Does not wait for partition operations, forces immediate shutdown. Useshutdown()for graceful shutdown. -
addLifecycleListener
Add a listener object to listen for lifecycle events.- Parameters:
lifecycleListener- the listener object- Returns:
- the listener ID
-
removeLifecycleListener
Removes a lifecycle listener.- Parameters:
registrationId- the listener ID returned byaddLifecycleListener(LifecycleListener)- Returns:
- true if the listener is removed successfully, false otherwise
-