Hazelcast Client

class HazelcastClient(config=None)

Bases: object

Hazelcast Client.

CLIENT_ID = <hazelcast.util.AtomicInteger object>
logger = <Logger HazelcastClient (WARNING)>
get_atomic_long(name)

Creates cluster-wide AtomicLong.

Parameters

name – (str), name of the AtomicLong proxy.

Returns

(AtomicLong), AtomicLong proxy for the given name.

get_atomic_reference(name)

Creates cluster-wide AtomicReference.

Parameters

name – (str), name of the AtomicReference proxy.

Returns

(AtomicReference), AtomicReference proxy for the given name.

get_count_down_latch(name)

Creates cluster-wide CountDownLatch.

Parameters

name – (str), name of the CountDownLatch proxy.

Returns

(CountDownLatch), CountDownLatch proxy for the given name.

get_executor(name)

Creates cluster-wide Executor.

Parameters

name – (str), name of the Executor proxy.

Returns

(Executor), Executor proxy for the given name.

get_flake_id_generator(name)

Creates or returns a cluster-wide FlakeIdGenerator.

Parameters

name – (str), name of the FlakeIdGenerator proxy.

Returns

(FlakeIdGenerator), FlakeIdGenerator proxy for the given name

get_id_generator(name)

Creates cluster-wide IdGenerator.

Parameters

name – (str), name of the IdGenerator proxy.

Returns

(IdGenerator), IdGenerator proxy for the given name.

get_queue(name)

Returns the distributed queue instance with the specified name.

Parameters

name – (str), name of the distributed queue.

Returns

(Queue), distributed queue instance with the specified name.

get_list(name)

Returns the distributed list instance with the specified name.

Parameters

name – (str), name of the distributed list.

Returns

(List), distributed list instance with the specified name.

get_lock(name)

Returns the distributed lock instance with the specified name.

Parameters

name – (str), name of the distributed lock.

Returns

(Lock), distributed lock instance with the specified name.

get_map(name)

Returns the distributed map instance with the specified name.

Parameters

name – (str), name of the distributed map.

Returns

(Map), distributed map instance with the specified name.

get_multi_map(name)

Returns the distributed MultiMap instance with the specified name.

Parameters

name – (str), name of the distributed MultiMap.

Returns

(MultiMap), distributed MultiMap instance with the specified name.

get_pn_counter(name)

Returns the PN Counter instance with the specified name.

Parameters

name – (str), name of the PN Counter.

Returns

(PNCounter), the PN Counter.

get_reliable_topic(name)

Returns the ReliableTopic instance with the specified name.

Parameters

name – (str), name of the ReliableTopic.

Returns

(ReliableTopic), the ReliableTopic.

get_replicated_map(name)

Returns the distributed ReplicatedMap instance with the specified name.

Parameters

name – (str), name of the distributed ReplicatedMap.

Returns

(ReplicatedMap), distributed ReplicatedMap instance with the specified name.

get_ringbuffer(name)

Returns the distributed RingBuffer instance with the specified name.

Parameters

name – (str), name of the distributed RingBuffer.

Returns

(RingBuffer), distributed RingBuffer instance with the specified name.

get_semaphore(name)

Returns the distributed Semaphore instance with the specified name.

Parameters

name – (str), name of the distributed Semaphore.

Returns

(Semaphore), distributed Semaphore instance with the specified name.

get_set(name)

Returns the distributed Set instance with the specified name.

Parameters

name – (str), name of the distributed Set.

Returns

(Set), distributed Set instance with the specified name.

get_topic(name)

Returns the Topic instance with the specified name.

Parameters

name – (str), name of the Topic.

Returns

(Topic), the Topic.

new_transaction(timeout=120, durability=1, type=1)

Creates a new Transaction associated with the current thread using default or given options.

Parameters
  • timeout – (long), the timeout in seconds determines the maximum lifespan of a transaction. So if a transaction is configured with a timeout of 2 minutes, then it will automatically rollback if it hasn’t committed yet.

  • durability – (int), the durability is the number of machines that can take over if a member fails during a

transaction commit or rollback :param type: (Transaction Type), the transaction type which can be TWO_PHASE or ONE_PHASE :return: (Transaction), new Transaction associated with the current thread.

add_distributed_object_listener(listener_func)

Adds a listener which will be notified when a new distributed object is created or destroyed. :param listener_func: Function to be called when a distributed object is created or destroyed. :return: (str), a registration id which is used as a key to remove the listener.

remove_distributed_object_listener(registration_id)

Removes the specified distributed object listener. Returns silently if there is no such listener added before. :param registration_id: (str), id of registered listener. :return: (bool), true if registration is removed, false otherwise.

get_distributed_objects()

Returns all distributed objects such as; queue, map, set, list, topic, lock, multimap. Also, as a side effect, it clears the local instances of the destroyed proxies. :return:(Sequence), List of instances created by Hazelcast.

shutdown()

Shuts down this HazelcastClient.