Lifecycle¶
-
class
LifecycleState¶ Bases:
objectLifecycle states.
-
STARTING= 'STARTING'¶ The client is starting.
-
STARTED= 'STARTED'¶ The client has started.
-
CONNECTED= 'CONNECTED'¶ The client connected to a member.
-
SHUTTING_DOWN= 'SHUTTING_DOWN'¶ The client is shutting down.
-
DISCONNECTED= 'DISCONNECTED'¶ The client disconnected from a member.
-
SHUTDOWN= 'SHUTDOWN'¶ The client has shutdown.
-
-
class
LifecycleService(internal_lifecycle_service)¶ Bases:
objectLifecycle service for the Hazelcast client. Allows to determine state of the client and add or remove lifecycle listeners.
-
is_running()¶ Checks whether or not the instance is running.
- Returns
True, if the client is active and running,Falseotherwise.- Return type
bool
-
add_listener(on_state_change)¶ Adds a listener to listen for lifecycle events.
- Parameters
on_state_change (function) – Function to be called when lifecycle state is changed.
- Returns
Registration id of the listener
- Return type
str
-
remove_listener(registration_id)¶ Removes a lifecycle listener.
- Parameters
registration_id (str) – The id of the listener to be removed.
- Returns
Trueif the listener is removed successfully,Falseotherwise.- Return type
bool
-