I have a requirement to pass a request from an html form to socket using a proprietory protocol. I am contemplating using an MBean, but there are two things that I'm not too sure about. Firstly, how would a session bean comunicate with the MBean and secondly would it be better to create a URLConnection and pool it as a resource?
Any comments would be greatful, I'm in a bit of a minefield at the moment..
You should be able to connect to an MBean from a session by looking up the connector from JNDI:
String serverName = InetAddress.getLocalHost().getHostName();
String connectorName = "jmx:" +serverName+ ":rmi";
RMIConnector server = (RMIConnector) new InitialContext().lookup(connectorName);
server.invoke(someObjectName, "someOperation", args, sign);