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

Ensure that the metrics collectors for MemcachedConnection gets initialized before it is used. #26

Closed shawn-higgins1 closed 2 years ago

shawn-higgins1 commented 2 years ago

Issue #, if available:

Description of changes: It is possible that if an UnresolvedAddressException or a SocketException is thrown on the initial connect that the queueReconnect will try to call the metricsCollector before it's been initialized. Since the metrics collector is initialized after attempting to make this initial connections.

This change fixes this issue by initializing the metrics collector before the connect calls

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