How to connect to jmx using groovy faster

I am using a weblogic example: http://groovy.codehaus.org/Groovy+and+JMX to connect jmx with groovy

The problem is that the connection takes too long:

    long time = System.currentTimeMillis();

    println System.currentTimeMillis() - time;
    def server = JMXConnectorFactory.connect(serviceURL, h).MBeanServerConnection
    println System.currentTimeMillis() - time;

I have about 200 groovy script. Each script does something else, but everything needs to connect to jmx. When I want to complete all this will take about an hour or more. Are there any options how to do this faster?

+5
source share
2 answers

so the answer is very simple. I need to use this project: http://kobo.imtqy.com/groovyserv/

then I just created a class JmxSharedConectionwith a static method where I add a connection, and now it works much faster

+2

tim [] singleton. , , script . pizass JMXConnection, , , , .

+1

All Articles