aboutsummaryrefslogtreecommitdiffstats
path: root/policy-core/src/main/java/org/onap/policy/drools/core/jmx
diff options
context:
space:
mode:
Diffstat (limited to 'policy-core/src/main/java/org/onap/policy/drools/core/jmx')
-rw-r--r--policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmx.java42
-rw-r--r--policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmxListener.java63
-rw-r--r--policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmxMBean.java7
3 files changed, 59 insertions, 53 deletions
diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmx.java b/policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmx.java
index 19f6afb4..e1a89752 100644
--- a/policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmx.java
+++ b/policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmx.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-core
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,29 +24,29 @@ import java.util.concurrent.atomic.AtomicLong;
public class PdpJmx implements PdpJmxMBean {
- private static PdpJmx instance = new PdpJmx();
- private final AtomicLong updates = new AtomicLong();
- private final AtomicLong actions = new AtomicLong();
+ private static PdpJmx instance = new PdpJmx();
+ private final AtomicLong updates = new AtomicLong();
+ private final AtomicLong actions = new AtomicLong();
- public static PdpJmx getInstance() {
- return instance;
- }
+ public static PdpJmx getInstance() {
+ return instance;
+ }
- @Override
- public long getUpdates(){
- return updates.longValue();
- }
+ @Override
+ public long getUpdates() {
+ return updates.longValue();
+ }
- @Override
- public long getRulesFired(){
- return actions.longValue();
- }
+ @Override
+ public long getRulesFired() {
+ return actions.longValue();
+ }
- public void updateOccured(){
- updates.incrementAndGet();
- }
+ public void updateOccured() {
+ updates.incrementAndGet();
+ }
- public void ruleFired(){
- actions.incrementAndGet();
- }
+ public void ruleFired() {
+ actions.incrementAndGet();
+ }
}
diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmxListener.java b/policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmxListener.java
index 9136defb..04f0dfd0 100644
--- a/policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmxListener.java
+++ b/policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmxListener.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-core
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,36 +35,41 @@ import org.slf4j.LoggerFactory;
public class PdpJmxListener {
- public static final Logger logger = LoggerFactory.getLogger(PdpJmxListener.class);
+ public static final Logger logger = LoggerFactory.getLogger(PdpJmxListener.class);
- private PdpJmxListener() {
- }
+ private PdpJmxListener() {
+ }
- public static void stop() {
- final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
- try {
- server.unregisterMBean(new ObjectName("PolicyEngine:type=PdpJmx"));
- } catch (MBeanRegistrationException | InstanceNotFoundException
- | MalformedObjectNameException e) {
- logger.error("PdpJmxListener.stop(): " +
- "Could not unregister PolicyEngine:type=PdpJmx MBean " +
- "with the MBean server", e);
- }
-
- }
+ /**
+ * Stop the listener.
+ */
+ public static void stop() {
+ final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+ try {
+ server.unregisterMBean(new ObjectName("PolicyEngine:type=PdpJmx"));
+ } catch (MBeanRegistrationException | InstanceNotFoundException
+ | MalformedObjectNameException e) {
+ logger.error("PdpJmxListener.stop(): "
+ + "Could not unregister PolicyEngine:type=PdpJmx MBean "
+ + "with the MBean server", e);
+ }
-
- public static void start() {
- final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
- try {
- server.registerMBean(PdpJmx.getInstance(), new ObjectName("PolicyEngine:type=PdpJmx"));
- } catch (InstanceAlreadyExistsException | MBeanRegistrationException
- | NotCompliantMBeanException | MalformedObjectNameException e) {
- logger.error("PdpJmxListener.start(): " +
- "Could not unregister PolicyEngine:type=PdpJmx MBean " +
- "with the MBean server", e);
- }
-
- }
+ }
+
+ /**
+ * Start.
+ */
+ public static void start() {
+ final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+ try {
+ server.registerMBean(PdpJmx.getInstance(), new ObjectName("PolicyEngine:type=PdpJmx"));
+ } catch (InstanceAlreadyExistsException | MBeanRegistrationException
+ | NotCompliantMBeanException | MalformedObjectNameException e) {
+ logger.error("PdpJmxListener.start(): "
+ + "Could not unregister PolicyEngine:type=PdpJmx MBean "
+ + "with the MBean server", e);
+ }
+
+ }
}
diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmxMBean.java b/policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmxMBean.java
index 37a9e4dc..d2c05f85 100644
--- a/policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmxMBean.java
+++ b/policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmxMBean.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-core
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ package org.onap.policy.drools.core.jmx;
public interface PdpJmxMBean {
- public long getRulesFired();
- public long getUpdates();
+ public long getRulesFired();
+
+ public long getUpdates();
}