aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/feature-controlloop-trans/src
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-08-14 14:22:34 -0400
committerPamela Dragosh <pdragosh@research.att.com>2018-08-14 14:22:41 -0400
commitdbe1d23be5420a5efa4d3977fee974c452bbfd29 (patch)
treecf5ab051e698d9278e6fd28022acbd5c1a9a91a2 /controlloop/common/feature-controlloop-trans/src
parent6f9976df27dccb2dcaedeb9106166f62a435b050 (diff)
Fix checkstyle issues
Spacing, missing javadoc Issue-ID: POLICY-883 Change-Id: Ice65c6c1baf0bb7c6273411f078bacfe3496b89b Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'controlloop/common/feature-controlloop-trans/src')
-rw-r--r--controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetrics.java65
-rw-r--r--controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java12
-rw-r--r--controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java5
3 files changed, 43 insertions, 39 deletions
diff --git a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetrics.java b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetrics.java
index 3c818b8b3..790d434fd 100644
--- a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetrics.java
+++ b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetrics.java
@@ -43,26 +43,26 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Control Loop Metrics Tracker
+ * Control Loop Metrics Tracker.
*/
public interface ControlLoopMetrics {
/**
- * gets all transaction identifiers being monitored
+ * Gets all transaction identifiers being monitored.
*
* @return transaction id list
*/
List<UUID> getTransactionIds();
/**
- * gets all detailed transactions
+ * Gets all detailed transactions.
*
* @return list of transactions
*/
List<VirtualControlLoopNotification> getTransactions();
/**
- * track controller's notification events
+ * Track controller's notification events.
*
* @param controller policy controller sending out notification
* @param notification notification
@@ -70,7 +70,7 @@ public interface ControlLoopMetrics {
void transactionEvent(PolicyController controller, VirtualControlLoopNotification notification);
/**
- * gets an in-progress transaction
+ * Gets an in-progress transaction.
*
* @param requestId request ID
* @return in progress notification
@@ -78,49 +78,49 @@ public interface ControlLoopMetrics {
VirtualControlLoopNotification getTransaction(UUID requestId);
/**
- * removes an in-progress transaction
+ * Removes an in-progress transaction.
*
* @param requestId request ID
*/
void removeTransaction(UUID requestId);
/**
- * get cache size
+ * Get cache size.
*
* @return cache size
*/
long getCacheSize();
/**
- * get cache size
+ * Get cache size.
*
* @return cache size
*/
long getCacheOccupancy();
/**
- * sets cache size
+ * Sets cache size.
*
* @param cacheSize cache size
*/
void setMaxCacheSize(long cacheSize);
/**
- * cached transaction expiration timeout in seconds
+ * Cached transaction expiration timeout in seconds.
*
* @return transaction timeout in seconds
*/
long getTransactionTimeout();
/**
- * sets transaction timeout in seconds
+ * Sets transaction timeout in seconds.
*
* @param transactionTimeout transaction timeout in seconds
*/
void setTransactionTimeout(long transactionTimeout);
/**
- * reset cache
+ * Reset cache.
*
* @param cacheSize new cache size
* @param transactionTimeout new transaction timeout in seconds
@@ -128,19 +128,19 @@ public interface ControlLoopMetrics {
void resetCache(long cacheSize, long transactionTimeout);
/**
- * refresh underlying transaction management
+ * Refresh underlying transaction management.
*/
void refresh();
/**
- * singleton manager object
+ * Singleton manager object.
*/
ControlLoopMetrics manager = new CacheBasedControlLoopMetricsManager();
}
/**
- * Control Loop Metrics Tracker Implementation
+ * Control Loop Metrics Tracker Implementation.
*/
class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics {
@@ -189,24 +189,24 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics {
CacheLoader<UUID, VirtualControlLoopNotification> loader =
new CacheLoader<UUID, VirtualControlLoopNotification>() {
- @Override
- public VirtualControlLoopNotification load(UUID key) throws Exception {
- return null;
- }
- };
+ @Override
+ public VirtualControlLoopNotification load(UUID key) throws Exception {
+ return null;
+ }
+ };
RemovalListener<UUID, VirtualControlLoopNotification> listener =
new RemovalListener<UUID, VirtualControlLoopNotification>() {
- @Override
- public void onRemoval(RemovalNotification<UUID, VirtualControlLoopNotification> notification) {
- if (notification.wasEvicted()) {
- evicted(notification.getValue());
- } else {
- logger.info("REMOVAL: {} because of {}", notification.getValue().getRequestId(),
+ @Override
+ public void onRemoval(RemovalNotification<UUID, VirtualControlLoopNotification> notification) {
+ if (notification.wasEvicted()) {
+ evicted(notification.getValue());
+ } else {
+ logger.info("REMOVAL: {} because of {}", notification.getValue().getRequestId(),
notification.getCause().name());
- }
- }
- };
+ }
+ }
+ };
synchronized (this) {
if (this.cache != null) {
@@ -280,7 +280,7 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics {
}
/**
- * tracks an in progress control loop transaction
+ * Tracks an in progress control loop transaction.
*
* @param notification control loop notification
*/
@@ -293,7 +293,7 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics {
}
/**
- * end of a control loop transaction
+ * End of a control loop transaction.
*
* @param notification control loop notification
*/
@@ -307,8 +307,9 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics {
}
this.transaction(notification, startTime);
- if (startNotification != null)
+ if (startNotification != null) {
cache.invalidate(startNotification);
+ }
}
protected void evicted(VirtualControlLoopNotification notification) {
diff --git a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java
index b15fb1479..37bafa45d 100644
--- a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java
+++ b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java
@@ -33,23 +33,23 @@ import org.slf4j.LoggerFactory;
public class ControlLoopMetricsFeature implements PolicyControllerFeatureAPI {
/**
- * Feature Sequence Priority
+ * Feature Sequence Priority.
*/
public final static int FEATURE_SEQUENCE_PRIORITY = 100000;
/**
- * Properties Configuration Name
+ * Properties Configuration Name.
*/
public static final String CONFIGURATION_PROPERTIES_NAME = "feature-controlloop-trans";
/**
- * maximum number of transaction cache entries
+ * Maximum number of transaction cache entries.
*/
public static final String CL_CACHE_TRANS_SIZE_PROPERTY = "controlloop.cache.transactions.size";
public static final int CL_CACHE_TRANS_SIZE_DEFAULT = 100;
/**
- * transaction timeout in minutes
+ * Transaction timeout in minutes.
*/
public static final String CL_CACHE_TRANS_TIMEOUT_SECONDS_PROPERTY =
"controllop.cache.transactions.timeout.seconds";
@@ -61,12 +61,12 @@ public class ControlLoopMetricsFeature implements PolicyControllerFeatureAPI {
}
/**
- * Logger
+ * Logger.
*/
private static Logger logger = LoggerFactory.getLogger(ControlLoopMetricsFeature.class);
/**
- * Intercept Control Loop Notifications
+ * Intercept Control Loop Notifications.
*
* @param controller - controller
* @param protocol - protocol
diff --git a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java
index df93c7a5e..1f1e9de39 100644
--- a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java
+++ b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java
@@ -39,13 +39,16 @@ import org.onap.policy.drools.system.PolicyController;
import org.onap.policy.drools.system.PolicyEngine;
/**
- * ControlLoopMetrics Tests
+ * ControlLoopMetrics Tests.
*/
public class ControlLoopMetricsFeatureTest {
private static final Path configPath = SystemPersistence.manager.getConfigurationPath();
private static PolicyController testController;
+ /**
+ * Setup method.
+ */
@BeforeClass
public static void setUp() {
SystemPersistence.manager.setConfigurationDir("src/test/resources");