Java Reference
In-Depth Information
ModelControllerClient.Factory.create
(InetAddress.getByName("localhost"),
9999);
ModelNode op = new ModelNode();
op.get("operation").set("read-resource");
op.get("include-runtime").set(true);
ModelNode address = op.get("address");
address.add("subsystem", "datasources");
address.add("data-source", "ExampleDS");
address.add("statistics", "pool");
ModelNode returnVal=null;
returnVal = client .execute(op);
ModelNode node2 = returnVal
.get("result");
String _activeCount =
node2.get("ActiveCount").asString();
if (_activeCount.equals("undefined")) {
return; // Connection unused
}
int activeCount =
Integer.parseInt(_activeCount);
if (activeCount > 50) {
alertAdministrator(); // Implement it !
}
}
catch (Exception exc) {
logger.info("Excepton !
"+exc.getMessage());
}
finally {
safeClose(client);
Search WWH ::




Custom Search