Skip to content

Commit 10e0a1a

Browse files
committed
get_distributed_object: skip unsupported proxies
- currently hz:impl:cacheService is not supported
1 parent 59d564f commit 10e0a1a

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

hazelcast/client.py

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
from hazelcast.errors import IllegalStateError, InvalidConfigurationError
1414
from hazelcast.future import Future
1515
from hazelcast.invocation import InvocationService, Invocation
16-
from hazelcast.lifecycle import LifecycleService, LifecycleState, _InternalLifecycleService
16+
from hazelcast.lifecycle import (
17+
LifecycleService,
18+
LifecycleState,
19+
_InternalLifecycleService,
20+
)
1721
from hazelcast.listener import ClusterViewListenerService, ListenerService
1822
from hazelcast.near_cache import NearCacheManager
1923
from hazelcast.partition import PartitionService, _InternalPartitionService
@@ -49,6 +53,7 @@
4953
Ringbuffer,
5054
Set,
5155
Topic,
56+
_proxy_init,
5257
)
5358
from hazelcast.proxy.base import Proxy
5459
from hazelcast.proxy.map import Map
@@ -67,6 +72,8 @@
6772

6873
_logger = logging.getLogger(__name__)
6974

75+
_SUPPORTED_DDS_NAMES = set(_proxy_init.keys())
76+
7077

7178
class HazelcastClient:
7279
"""Hazelcast client instance to access and manipulate distributed data
@@ -227,7 +234,9 @@ def _start(self):
227234
self._internal_lifecycle_service.start()
228235
self._invocation_service.start()
229236
membership_listeners = self._config.membership_listeners
230-
self._internal_cluster_service.start(self._connection_manager, membership_listeners)
237+
self._internal_cluster_service.start(
238+
self._connection_manager, membership_listeners
239+
)
231240
self._cluster_view_listener.start()
232241
self._connection_manager.start(self._load_balancer)
233242
sync_start = not self._config.async_start
@@ -494,9 +503,16 @@ def get_distributed_objects(self) -> typing.List[Proxy]:
494503
for dist_obj in self._proxy_manager.get_distributed_objects()
495504
}
496505

497-
response = client_get_distributed_objects_codec.decode_response(invocation.future.result())
506+
response = client_get_distributed_objects_codec.decode_response(
507+
invocation.future.result()
508+
)
509+
498510
for dist_obj_info in response:
499511
local_distributed_object_infos.discard(dist_obj_info)
512+
513+
# skip unsupported proxies, e.g., hz:impl:cacheService
514+
if dist_obj_info.service_name not in _SUPPORTED_DDS_NAMES:
515+
continue
500516
self._proxy_manager.get_or_create(
501517
dist_obj_info.service_name, dist_obj_info.name, create_on_remote=False
502518
)
@@ -512,15 +528,19 @@ def shutdown(self) -> None:
512528
"""Shuts down this HazelcastClient."""
513529
with self._shutdown_lock:
514530
if self._internal_lifecycle_service.running:
515-
self._internal_lifecycle_service.fire_lifecycle_event(LifecycleState.SHUTTING_DOWN)
531+
self._internal_lifecycle_service.fire_lifecycle_event(
532+
LifecycleState.SHUTTING_DOWN
533+
)
516534
self._internal_lifecycle_service.shutdown()
517535
self._proxy_session_manager.shutdown().result()
518536
self._near_cache_manager.destroy_near_caches()
519537
self._connection_manager.shutdown()
520538
self._invocation_service.shutdown()
521539
self._statistics.shutdown()
522540
self._reactor.shutdown()
523-
self._internal_lifecycle_service.fire_lifecycle_event(LifecycleState.SHUTDOWN)
541+
self._internal_lifecycle_service.fire_lifecycle_event(
542+
LifecycleState.SHUTDOWN
543+
)
524544

525545
@property
526546
def name(self) -> str:
@@ -573,7 +593,9 @@ def _create_address_provider(self):
573593

574594
if cloud_enabled:
575595
connection_timeout = self._get_connection_timeout(config)
576-
return HazelcastCloudAddressProvider(cloud_discovery_token, connection_timeout)
596+
return HazelcastCloudAddressProvider(
597+
cloud_discovery_token, connection_timeout
598+
)
577599

578600
return DefaultAddressProvider(cluster_members)
579601

0 commit comments

Comments
 (0)