The current model requires injecting the HttpNettyClient into a JMX MBean. This doesn't work well with the current pattern of using the client, since the client type is abstracted and multiple clients could be created, resulting in a need to manage multiple MBeans even though the DNS resolution logic is shared globally.
This change lets the MBean itself hold the stats, and the Netty client will call back to it to increment the counters. This way when the HttpClientFactory is created we can provide it with a single MBean to track DNS across all clients, and the factory can handle injecting it properly into an applicable client instances it creates.
The current model requires injecting the
HttpNettyClient
into a JMX MBean. This doesn't work well with the current pattern of using the client, since the client type is abstracted and multiple clients could be created, resulting in a need to manage multiple MBeans even though the DNS resolution logic is shared globally.This change lets the MBean itself hold the stats, and the Netty client will call back to it to increment the counters. This way when the
HttpClientFactory
is created we can provide it with a single MBean to track DNS across all clients, and the factory can handle injecting it properly into an applicable client instances it creates.