Lifecycle

class LifecycleState[source]

Bases: object

Lifecycle 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)[source]

Bases: object

Lifecycle service for the Hazelcast client. Allows to determine state of the client and add or remove lifecycle listeners.

is_running()[source]

Checks whether or not the instance is running.

Returns

True if the client is active and running, False otherwise.

Return type

bool

add_listener(on_state_change)[source]

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)[source]

Removes a lifecycle listener.

Parameters

registration_id (str) – The id of the listener to be removed.

Returns

True if the listener is removed successfully, False otherwise.

Return type

bool