awslabs / aws-elasticache-cluster-client-memcached-for-java

Amazon ElastiCache Cluster Client for Java - enhanced library to connect to ElastiCache clusters.
http://docs.amazonwebservices.com/AmazonElastiCache/latest/UserGuide/AutoDiscovery.html
Apache License 2.0
87 stars 54 forks source link

Handle the UnresolvedAddressException in the createConnections function. #25

Closed shawn-higgins1 closed 2 years ago

shawn-higgins1 commented 2 years ago

Issue #, if available: N/A

Description of changes: This exception can be thrown if the DNS for the configuration endpoint doesn't resolve. It possible that the DNS may take some time to updated and in those situations the UnresolvedAddressException will be thrown on the ch.connect(sa) call line 479.

Currently if this exception is thrown the SocketChannel gets leaked because the sockets and never cleaned up after the exception is thrown.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.