How to set request timeout for JMX Connector

前端 未结 2 2029
执笔经年
执笔经年 2021-02-07 09:59

I\'m trying to set request timeout for JMX Connector but seems like it doesn\'t work.

env.put(\"jmx.remote.x.request.waiting.timeout\", new Long(30000));
         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-07 10:59

    u can try these codes to set the JMX connector timeout:

       JMXConnector connectWithTimeout(JMXServiceURL url, long timeout, TimeUnit unit) {
        ExecutorService executor = Executors.newSingleThreadExecutor();
           Future future = executor.submit(new Callable() {
                public JMXConnector call() {
                    return JMXConnectorFactory.connect(url);
                }
                  });
           return future.get(timeout, unit);
              }
    

提交回复
热议问题