Search code examples
hazelcast

How to determine if Hazelcast CPSubsystem is enabled?


Is there any way to validate if Hazelcast's CPSubsystem (introduced in HC 3.12) is enabled by an HC member or client? If I try to access the CPSubsystem and it isn't enabled, HC will throw an exception. However, using exceptions for flow control is a bad practice, and I would rather check if it is enabled first prior to accessing it.

I haven't been able to find any mechanism to allow me to query its status without tripping the exception. Does such a method exist?


Solution

  • Unfortunately only way to figure out whether or not CPSubsystem is enabled to check CPSubsystemConfig.cpMemberCount > 0. But server configuration is not accessible on client, so this does not work on clients.

    PS: I have submitted a new enhancement issue to a new API method: https://github.com/hazelcast/hazelcast/issues/15413