Add support for jmxfetch0.4

Support for attach api
Fix thread leak when exceeding the metrics limit