Java Reference
In-Depth Information
and read the response. Then, we are connecting to the local WildFly instance and issuing a
:jndi-view command.
Note
The connect command can be used to connect to a remote WildFly host as well by
adding the following parameters: connect (String controllerHost, int
controllerPort, String username, String password) .
The response variable is org.jboss.dmr.ModelNode . This can be further inspected
as shown in the following example, which goes in to some depth about platform MBeans,
to get some memory statistics:
from org.jboss.as.cli.scriptsupport import CLI
cli = CLI.newInstance()
cli.connect()
cli.cmd("cd /core-service=platform-mbean/type=memory/")
result =
cli.cmd(":read-resource(recursive=false,proxies=false,include-runtime=true,include-defaults=true)")
response = result.getResponse()
enabled = response.get("result").get("heap-memory-usage")
used = enabled.get("used").asInt()
if used > 512000000:
print "Over 1/2 Gb Memory usage "
else:
print 'Low usage!'
cli.disconnect()
In the previous example, we tracked the resources contained in /core-
service=platform-mbean/type=memory . The available resources are, however,
child resources of the two kinds of available heap memory areas ( heap-memory-us-
age and non-heap-memory-usage ), as shown by the following code:
Search WWH ::




Custom Search