Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Bug 1029409 - Auto-enable ejb3 statistics when a user requests calltime
Browse files Browse the repository at this point in the history
metrics for EJBs

Fix NPE when enable-statistics is undefined

(cherry picked from commit 87f7ea8)
Signed-off-by: Jirka Kremser <jkremser@redhat.com>
  • Loading branch information
Libor Zoubek authored and jkremser committed Oct 3, 2014
1 parent 4e5fc32 commit bd45164
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -301,18 +301,20 @@ private void ensureGlobalEJB3StatisticsEnabled() {
if (ejb3StatisticsEnalbed != null && ejb3StatisticsEnalbed.booleanValue()) {
return;
}
Address ejbAddress = new Address(getServerComponent().getServerAddress());
BaseServerComponent server = getServerComponent();
Address ejbAddress = new Address(server.getServerAddress());
ejbAddress.add("subsystem", "ejb3");
try {
ejb3StatisticsEnalbed = readAttribute(ejbAddress, "enable-statistics", Boolean.class);
if (!ejb3StatisticsEnalbed) {
if (!Boolean.TRUE.equals(ejb3StatisticsEnalbed)) {
getLog().debug("Enabling global EJB3 statistics");
WriteAttribute op = new WriteAttribute(ejbAddress, "enable-statistics", true);
Result result = getASConnection().execute(op);
if (result.isSuccess()) {
getLog()
.info(
"Global EJB3 statistics is now enabled, because there is a request to collect EJB Calltime metrics.");
server.context.getResourceDetails()
+ " Global EJB3 statistics is now enabled, because there is a request to collect EJB Calltime metrics.");
} else {
getLog().error("Failed to enable EJB3 statistics : " + result.getFailureDescription());
}
Expand Down

0 comments on commit bd45164

Please sign in to comment.