timeout - MBeanServerConnection.invoke hangs forever -
we have app invokes various remote methods on mbeans using mbeanserverconnection.invoke. 1 of these methods hangs. there way have timeout on call? return exception if call takes long?
or have move calls separate threads don't lock ui , require killing app?
see http://weblogs.java.net/blog/emcmanus/archive/2007/05/making_a_jmx_co.html
===== update =====
i thinking stuff when first responded, on mobile , can't type worth damn on it.....
this rmi problem, , unless use different protocol, there's not can do, except, say, move calls separate threads don't lock ui.
but.... if have option of fiddling target server , can customize connecting client, have @ least 1 option customize jmxconnectorserver on target servers.
the standard jmxconnectorserver implementation rmiconnectorserver. part of it's specification when create new instance using of constructors (like rmiconnectorserver(jmxserviceurl url, map environment)), environment map can contain key/value pair key rmiconnectorserver.rmi_client_socket_factory_attribute , value rmiclientsocketfactory. therefore, can specify socket factory method this:
rmiclientsocketfactory clientsocketfatory = new rmiclientsocketfactory() { public socket createsocket(string host, int port) { socket s = new socket(host, port); s.setsotimeout(3000); } }; this factory creates socket , sets so_timeout using setsotimeout, when client connects using socket, all operations, including connecting, timeout after 3000 ms.
you checkout jmxmp connector , server in jmx-optional package of opendmk. (links github mavenized). no built in solution, mind you, they're super easy extend , jmxmp simple tcp socket based rather rmi, type of customization trivial.
cheers.
Comments
Post a Comment