如何更快地连接到gromy的jmx

hud*_*udi 5 groovy jmx

我使用weblogic示例:http://groovy.codehaus.org/Groovy+and+JMX将jmx与groovy连接起来

问题是连接时间太长:

    long time = System.currentTimeMillis();

    println System.currentTimeMillis() - time;
    def server = JMXConnectorFactory.connect(serviceURL, h).MBeanServerConnection
    println System.currentTimeMillis() - time;
Run Code Online (Sandbox Code Playgroud)

我有大约200个groovy脚本.每个脚本都在做其他事情,但都需要连接到jmx.当我想要执行所有操作时需要大约一小时甚至更长时间.有没有选择如何更快地做到这一点?

hud*_*udi 2

所以答案很简单。我需要使用这个项目: http: //kobo.github.io/groovyserv/

然后我刚刚使用JmxSharedConection静态方法创建了类,在其中添加了连接,现在它的工作速度更快了