Java Reference
In-Depth Information
operation.get("address");
address.add("subsystem", "datasources");
address.add("data-source", "ExampleDS");
address.add("statistics", "pool");
final ModelNode returnVal =
client.execute(operation);
final ModelNode node2 = returnVal.get("result");
final String stringActiveCount =
node2.get("ActiveCount").asString();
if (stringActiveCount.equals("undefined")) {
return; // Connection unused
}
int activeCount =
Integer.parseInt(stringActiveCount);
if (activeCount > 50) {
alertAdministrator();
}
} catch (Exception exc) {
logger.log(Level.SEVERE, "Exception !", exc);
} finally {
safeClose(client);
}
}
public void safeClose(final Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (Exception e) {
logger.log(Level.SEVERE, "Exception closing
the client! ", e);
}
}
}
private void alertAdministrator() {
Search WWH ::




Custom Search