Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow binding 'any' port w/o using the port inc method of hazelcast #9775
"bind any" is a built-in java server socket factory java functionality. I would like to be able to set in the HZ configuration this option so I won't have to specify setPortAutoIncrement, and port count. I would like to be able to say 'bind any available' and let the jvm choose some random free port. Maybe jsut set port=0 in configuration...
This can be easily achieved by providing 0 (zero) as port to the serversocket.bind . Unfortunately , when trying to use setPort(0) with hz network config it is not working as expected. The instance will bind random port as required, but the "BindAddress" and "PublicAddress" will be populated with port=0, as in configuration. As result, the cluster members will not see each other. The most simple solution is to use the resolved port (taken from socket) rather of the configured port.
For a workaround, Please refer:
This is a complicated solution. a much simple solution can be added into your code.