远程访问JMS MBean

Properties props = new Properties();
props.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); 
props.put(InitialContext.PROVIDER_URL, "localhost:1099");
Context ctx = new InitialContext(props);
RMIAdaptor server = (RMIAdaptor) ctx.lookup("jmx/invoker/RMIAdaptor");
        
ObjectName name = new ObjectName("jboss.mq.destination:name=A,service=Queue");
        MBeanInfo  info = server.getMBeanInfo(name);
server.invoke(name, "stop", null, null);

构造ObjectName,用得到的server执行它

你可能感兴趣的:(jboss,jms)