Skip to content

Commit 5c7a4d5

Browse files
space88manyuce
andauthored
get_distributed_objects: skip unsupported cacheService (#747)
This client does not support cacheService so the iteration in `get_distributed_objects` will throw an exception if the cluster is also used by Java+JCache clients (e.g. Spring Boot with Hazelcast as cache provider). This fix just skips `hz:impl:cacheService` objects. Addresses #746 Co-authored-by: Yüce Tekol <[email protected]>
1 parent 34738b6 commit 5c7a4d5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

hazelcast/client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
Ringbuffer,
5050
Set,
5151
Topic,
52+
_proxy_init,
5253
)
5354
from hazelcast.proxy.base import Proxy
5455
from hazelcast.proxy.map import Map
@@ -67,6 +68,8 @@
6768

6869
_logger = logging.getLogger(__name__)
6970

71+
_SUPPORTED_DDS_NAMES = set(_proxy_init.keys())
72+
7073

7174
class HazelcastClient:
7275
"""Hazelcast client instance to access and manipulate distributed data
@@ -495,8 +498,13 @@ def get_distributed_objects(self) -> typing.List[Proxy]:
495498
}
496499

497500
response = client_get_distributed_objects_codec.decode_response(invocation.future.result())
501+
498502
for dist_obj_info in response:
499503
local_distributed_object_infos.discard(dist_obj_info)
504+
505+
# skip unsupported proxies, e.g., hz:impl:cacheService
506+
if dist_obj_info.service_name not in _SUPPORTED_DDS_NAMES:
507+
continue
500508
self._proxy_manager.get_or_create(
501509
dist_obj_info.service_name, dist_obj_info.name, create_on_remote=False
502510
)

0 commit comments

Comments
 (0)