aboutsummaryrefslogtreecommitdiffstats
path: root/feature-pooling-dmaap/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'feature-pooling-dmaap/src/main')
-rw-r--r--feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java13
-rw-r--r--feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/ActiveState.java17
-rw-r--r--feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/FilterUtils.java16
3 files changed, 24 insertions, 22 deletions
diff --git a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java
index da8a918f..00b7a215 100644
--- a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java
+++ b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 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.
@@ -158,7 +158,7 @@ public class PoolingFeature implements PolicyEngineFeatureApi, PolicyControllerF
ctlr2pool.computeIfAbsent(name, xxx -> makeManager(host, controller, props, activeLatch));
} catch (PropertyException e) {
- logger.error("pooling disabled due to exception for {}", name, e);
+ logger.error("pooling disabled due to exception for {}", name);
throw new PoolingFeatureRtException(e);
}
@@ -196,12 +196,15 @@ public class PoolingFeature implements PolicyEngineFeatureApi, PolicyControllerF
@Override
public boolean afterShutdown(PolicyController controller) {
- deleteManager(controller);
- return false;
+ return commonShutdown(controller);
}
@Override
public boolean afterHalt(PolicyController controller) {
+ return commonShutdown(controller);
+ }
+
+ private boolean commonShutdown(PolicyController controller) {
deleteManager(controller);
return false;
}
@@ -284,7 +287,7 @@ public class PoolingFeature implements PolicyEngineFeatureApi, PolicyControllerF
boolean success) {
// clear any stored arguments
- offerArgs.set(null);
+ offerArgs.remove();
return false;
}
diff --git a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/ActiveState.java b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/ActiveState.java
index 58205ddd..c5ee2ae3 100644
--- a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/ActiveState.java
+++ b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/ActiveState.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018, 2020 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -67,7 +67,7 @@ public class ActiveState extends ProcessingState {
/**
* Constructor.
- *
+ *
* @param mgr pooling manager
*/
public ActiveState(PoolingManager mgr) {
@@ -97,7 +97,7 @@ public class ActiveState extends ProcessingState {
// wrapped around - successor is the first host in the set
succHost = assigned.first();
}
- logger.info("this host's successor is {} on topic {}", succHost, getTopic());
+ logger.info("this host's successor is {} on topic {}", succHost, getTopic());
if ((predHost = assigned.lower(getHost())) == null) {
// wrapped around - predecessor is the last host in the set
@@ -185,7 +185,6 @@ public class ActiveState extends ProcessingState {
if (src == null) {
logger.warn("Heartbeat message has no source on topic {}", getTopic());
- return null;
} else if (src.equals(getHost())) {
logger.info("saw my heartbeat on topic {}", getTopic());
@@ -194,7 +193,7 @@ public class ActiveState extends ProcessingState {
} else if (src.equals(predHost)) {
logger.info("saw heartbeat from {} on topic {}", src, getTopic());
predHeartbeatSeen = true;
-
+
} else {
logger.info("ignored heartbeat message from {} on topic {}", src, getTopic());
}
@@ -239,10 +238,10 @@ public class ActiveState extends ProcessingState {
} else if (isLeader() || (predHost.equals(src) && predHost.equals(assigned.first()))) {
/*
* Case 1: We are the leader.
- *
+ *
* Case 2: Our predecessor was the leader and it has gone offline - we should
* become the leader.
- *
+ *
* In either case, we are now the leader and we must re-balance the buckets
* since one of the hosts has gone offline.
*/
diff --git a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/FilterUtils.java b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/FilterUtils.java
index 1616f03e..5b7012d2 100644
--- a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/FilterUtils.java
+++ b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/FilterUtils.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,7 +52,7 @@ public class FilterUtils {
/**
* Makes a filter that verifies that a field equals a value.
- *
+ *
* @param field name of the field to check
* @param value desired value
* @return a map representing an "equals" filter
@@ -68,11 +68,11 @@ public class FilterUtils {
/**
* Makes an "and" filter, where all of the items must be true.
- *
+ *
* @param items items to be checked
* @return an "and" filter
*/
- public static Map<String, Object> makeAnd(Map<String, Object>... items) {
+ public static Map<String, Object> makeAnd(@SuppressWarnings("unchecked") Map<String, Object>... items) {
Map<String, Object> map = new TreeMap<>();
map.put(JSON_CLASS, CLASS_AND);
map.put(JSON_FILTERS, items);
@@ -82,11 +82,11 @@ public class FilterUtils {
/**
* Makes an "or" filter, where at least one of the items must be true.
- *
+ *
* @param items items to be checked
* @return an "or" filter
*/
- public static Map<String, Object> makeOr(Map<String, Object>... items) {
+ public static Map<String, Object> makeOr(@SuppressWarnings("unchecked") Map<String, Object>... items) {
Map<String, Object> map = new TreeMap<>();
map.put(JSON_CLASS, CLASS_OR);
map.put(JSON_FILTERS, items);