@Override public void collect(JmxCollectorConfig config, MBeanServer mBeanServer, JmxSampleProcessor sampleProcessor) throws JmxServerConnectionException { Map<String, String> mergedStringMap = new HashMap<>(config.getServiceProperties()); if (mBeanServer != null) { mergedStringMap.putAll(mBeanServer.getParameterMap()); } JmxConnectionManager connectionManager = new DefaultConnectionManager(config.getRetries()); try (JmxServerConnectionWrapper connectionWrapper = connectionManager.connect(config.getConnectionName(), InetAddressUtils.addr(config.getAgentAddress()), mergedStringMap, null)) { Objects.requireNonNull(connectionWrapper, "connectionWrapper should never be null"); Objects.requireNonNull(connectionWrapper.getMBeanServerConnection(), "connectionWrapper.getMBeanServerConnection() should never be null"); final MBeanServerConnection concreteConnection = connectionWrapper.getMBeanServerConnection(); collect(concreteConnection, config.getJmxCollection(), sampleProcessor); } }
@Override public void collect(JmxCollectorConfig config, MBeanServer mBeanServer, JmxSampleProcessor sampleProcessor) throws JmxServerConnectionException { Map<String, String> mergedStringMap = new HashMap<>(config.getServiceProperties()); if (mBeanServer != null) { mergedStringMap.putAll(mBeanServer.getParameterMap()); } JmxConnectionManager connectionManager = new DefaultConnectionManager(config.getRetries()); try (JmxServerConnectionWrapper connectionWrapper = connectionManager.connect(config.getConnectionName(), InetAddressUtils.addr(config.getAgentAddress()), mergedStringMap, null)) { Objects.requireNonNull(connectionWrapper, "connectionWrapper should never be null"); Objects.requireNonNull(connectionWrapper.getMBeanServerConnection(), "connectionWrapper.getMBeanServerConnection() should never be null"); final MBeanServerConnection concreteConnection = connectionWrapper.getMBeanServerConnection(); collect(concreteConnection, config.getJmxCollection(), sampleProcessor); } }
try (JmxServerConnectionWrapper connection = connectionManager.connect(getConnectionName(), ipv4Addr, JmxUtils.convertToStringMap(map), retryCallback)) {