<subsystem xmlns="urn:jboss:domain:remoting:8.0"> <connector name="remoting-connector" socket-binding="remoting"/> </subsystem> shell /subsystem=remoting/connector=remoting-connector:write-attribute(name=enabled,value=false) import org.jboss.as.controller.client.ModelControllerClient; import org.jboss.as.controller.client.helpers.ClientConstants; public class RemotingMonitor { public static void main(String[] args) throws Exception { ModelControllerClient client = ModelControllerClient.Factory.create("localhost", 9990); try { ModelNode op = new ModelNode(); op.get(ClientConstants.OP).set(ClientConstants.READ_ATTRIBUTE_OPERATION); op.get(ClientConstants.NAME).set("remoting-connector"); op.get(ClientConstants.ADDRESS).add("subsystem", "remoting"); op.get(ClientConstants.ATTRIBUTE).set("connection-count"); ModelNode result = client.execute(op); int activeConnections = result.get(ClientConstants.RESULT).asInt(); } finally { client.close(); } } }


上一篇:
下一篇:
切换中文