src/main/java/org/jmxtrans/agent/JmxTransAgent.java
private static boolean waitForCustomMBeanServer(int timeoutInSeconds) {
        long startInMs = System.currentTimeMillis();

        while (!isCustomMBeanServerConfigured() && secondsSince(startInMs) < timeoutInSeconds) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                Thread.interrupted();
                return false;
            }
        }

        if (secondsSince(startInMs) >= timeoutInSeconds) {
            logger.info("jmxagent initialization timed out waiting for custom MBeanServer");
            return false;
        }

        return true;
    }
private static boolean waitForCustomMBeanServer(int timeoutInSeconds) {
        long startInMs = System.currentTimeMillis();

        while (!isCustomMBeanServerConfigured() && secondsSince(startInMs) < timeoutInSeconds) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                Thread.interrupted();
                return false;
            }
        }

        if (secondsSince(startInMs) >= timeoutInSeconds) {
            logger.info("jmxagent initialization timed out waiting for custom MBeanServer");
            return false;
        }

        return true;
    }
Polls every second to see if any {@link javax.management.MBeanServer} have been created
by another thread up to {@code timeoutInSeconds}. If interrupted or timed out, returns
{@code false}.
@param timeoutInSeconds Maximum number of seconds to wait before giving up.
@return {@code true} if found an {@code MBeanServer} within {@code timeoutInSeconds}.
{@code false} otherwise.