Package com.hazelcast.core
Interface LifecycleService
public interface LifecycleService
LifecycleService allows you to shut down, terminate, and listen to
LifecycleEvent
s
on HazelcastInstance.-
Method Summary
Modifier and TypeMethodDescriptionaddLifecycleListener
(LifecycleListener lifecycleListener) 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
shutdown()
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 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
-