Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Hazelcast Client thread safe?

Tags:

hazelcast

I cannot find this in the docs or javadocs: do I need to create one client per thread or is a client created by:

client = HazelcastClient.newHazelcastClient(cfg);

thread safe?

like image 372
Karussell Avatar asked Feb 13 '23 03:02

Karussell


1 Answers

The client is thread-safe. Also when you get e.g. an IMap from it, it also is thread-safe.

HazelcastInstance client = HazelcastClient.newHazelcastClient(cfg)
IMap map = client.getMap("map");

So you can share this client instance with all your threads in the JVM.

like image 114
pveentjer Avatar answered Mar 27 '23 16:03

pveentjer