aboutsummaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-05-06 11:28:53 -0400
committerJim Hahn <jrh3@att.com>2021-05-06 15:26:24 -0400
commit1d0aaaa5b31719c1718700bb0d1a99c413fd513c (patch)
treebd2687f1d38f3e3c4e53a68695c8c91c6866468e /policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event
parent3b00f1c32b89282dcbb74d3d3645e263f005319e (diff)
Fix sonars in policy-common
Fixed sonars: - use "var" instead of actual type name - re-interrupt threads - use rej2 split() instead of String split() Issue-ID: POLICY-3285 Change-Id: I82261e0b8a53ee5c5264556fbf5cec37454f014e Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event')
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxy.java6
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSinkFactory.java12
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSourceFactory.java10
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSinkFactory.java12
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSourceFactory.java16
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java12
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/TopicBaseHashedFactory.java4
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java12
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java4
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java4
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java4
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java6
12 files changed, 56 insertions, 46 deletions
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxy.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxy.java
index b86532fc..cf89762a 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxy.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxy.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 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.
@@ -365,7 +365,7 @@ class TopicEndpointProxy implements TopicEndpoint {
final List<Startable> endpoints = this.getEndpoints();
- boolean success = true;
+ var success = true;
for (final Startable endpoint : endpoints) {
try {
success = endpoint.start() && success;
@@ -391,7 +391,7 @@ class TopicEndpointProxy implements TopicEndpoint {
final List<Startable> endpoints = this.getEndpoints();
- boolean success = true;
+ var success = true;
for (final Startable endpoint : endpoints) {
try {
success = endpoint.stop() && success;
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSinkFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSinkFactory.java
index 6f0753b3..30618d98 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSinkFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSinkFactory.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 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,6 +24,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;
+import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.event.comm.bus.internal.InlineDmaapTopicSink;
@@ -38,6 +39,7 @@ import org.slf4j.LoggerFactory;
*/
class IndexedDmaapTopicSinkFactory implements DmaapTopicSinkFactory {
+ private static final Pattern COMMA_SPACE_PAT = Pattern.compile("\\s*,\\s*");
private static final String MISSING_TOPIC = "A topic must be provided";
/**
@@ -62,7 +64,7 @@ class IndexedDmaapTopicSinkFactory implements DmaapTopicSinkFactory {
return dmaapTopicWriters.get(busTopicParams.getTopic());
}
- DmaapTopicSink dmaapTopicSink = makeSink(busTopicParams);
+ var dmaapTopicSink = makeSink(busTopicParams);
if (busTopicParams.isManaged()) {
dmaapTopicWriters.put(busTopicParams.getTopic(), dmaapTopicSink);
@@ -93,7 +95,7 @@ class IndexedDmaapTopicSinkFactory implements DmaapTopicSinkFactory {
List<DmaapTopicSink> newDmaapTopicSinks = new ArrayList<>();
synchronized (this) {
- for (String topic : writeTopics.split("\\s*,\\s*")) {
+ for (String topic : COMMA_SPACE_PAT.split(writeTopics)) {
addTopic(newDmaapTopicSinks, properties, topic);
}
return newDmaapTopicSinks;
@@ -108,7 +110,7 @@ class IndexedDmaapTopicSinkFactory implements DmaapTopicSinkFactory {
String topicPrefix = PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." + topic;
- PropertyUtils props = new PropertyUtils(properties, topicPrefix,
+ var props = new PropertyUtils(properties, topicPrefix,
(name, value, ex) -> logger.warn("{}: {} {} is in invalid format for topic {} ", this, name, value, topic));
String servers = properties.getProperty(topicPrefix + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX);
@@ -117,7 +119,7 @@ class IndexedDmaapTopicSinkFactory implements DmaapTopicSinkFactory {
return;
}
- DmaapTopicSink dmaapTopicSink = this.build(DmaapPropertyUtils.makeBuilder(props, topic, servers)
+ var dmaapTopicSink = this.build(DmaapPropertyUtils.makeBuilder(props, topic, servers)
.partitionId(props.getString(PolicyEndPointProperties.PROPERTY_TOPIC_SINK_PARTITION_KEY_SUFFIX, null))
.build());
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSourceFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSourceFactory.java
index d7f4695e..8c168f76 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSourceFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedDmaapTopicSourceFactory.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 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,6 +24,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;
+import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.event.comm.bus.internal.SingleThreadedDmaapTopicSource;
@@ -38,6 +39,7 @@ import org.slf4j.LoggerFactory;
*/
class IndexedDmaapTopicSourceFactory implements DmaapTopicSourceFactory {
+ private static final Pattern COMMA_SPACE_PAT = Pattern.compile("\\s*,\\s*");
private static final String MISSING_TOPIC = "A topic must be provided";
/**
@@ -62,7 +64,7 @@ class IndexedDmaapTopicSourceFactory implements DmaapTopicSourceFactory {
return dmaapTopicSources.get(busTopicParams.getTopic());
}
- DmaapTopicSource dmaapTopicSource = makeSource(busTopicParams);
+ var dmaapTopicSource = makeSource(busTopicParams);
if (busTopicParams.isManaged()) {
dmaapTopicSources.put(busTopicParams.getTopic(), dmaapTopicSource);
@@ -82,7 +84,7 @@ class IndexedDmaapTopicSourceFactory implements DmaapTopicSourceFactory {
List<DmaapTopicSource> dmaapTopicSourceLst = new ArrayList<>();
synchronized (this) {
- for (String topic : readTopics.split("\\s*,\\s*")) {
+ for (String topic : COMMA_SPACE_PAT.split(readTopics)) {
addTopic(dmaapTopicSourceLst, properties, topic);
}
}
@@ -117,7 +119,7 @@ class IndexedDmaapTopicSourceFactory implements DmaapTopicSourceFactory {
String topicPrefix = PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic;
- PropertyUtils props = new PropertyUtils(properties, topicPrefix,
+ var props = new PropertyUtils(properties, topicPrefix,
(name, value, ex) -> logger.warn("{}: {} {} is in invalid format for topic {} ", this, name, value, topic));
String servers = properties.getProperty(topicPrefix + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX);
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSinkFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSinkFactory.java
index 150a02c0..ad2c2e2f 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSinkFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSinkFactory.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 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,6 +24,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;
+import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.event.comm.bus.internal.InlineUebTopicSink;
@@ -37,6 +38,7 @@ import org.slf4j.LoggerFactory;
* Factory of UEB Reader Topics indexed by topic name.
*/
class IndexedUebTopicSinkFactory implements UebTopicSinkFactory {
+ private static final Pattern COMMA_SPACE_PAT = Pattern.compile("\\s*,\\s*");
private static final String MISSING_TOPIC = "A topic must be provided";
/**
@@ -99,7 +101,7 @@ class IndexedUebTopicSinkFactory implements UebTopicSinkFactory {
List<UebTopicSink> newUebTopicSinks = new ArrayList<>();
synchronized (this) {
- for (String topic : writeTopics.split("\\s*,\\s*")) {
+ for (String topic : COMMA_SPACE_PAT.split(writeTopics)) {
addTopic(newUebTopicSinks, topic, properties);
}
return newUebTopicSinks;
@@ -114,7 +116,7 @@ class IndexedUebTopicSinkFactory implements UebTopicSinkFactory {
String topicPrefix = PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." + topic;
- PropertyUtils props = new PropertyUtils(properties, topicPrefix,
+ var props = new PropertyUtils(properties, topicPrefix,
(name, value, ex) -> logger.warn("{}: {} {} is in invalid format for topic {} ", this, name, value, topic));
String servers = properties.getProperty(topicPrefix + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX);
@@ -194,9 +196,7 @@ class IndexedUebTopicSinkFactory implements UebTopicSinkFactory {
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("IndexedUebTopicSinkFactory []");
- return builder.toString();
+ return "IndexedUebTopicSinkFactory []";
}
}
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSourceFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSourceFactory.java
index 5bdc8ab6..367d4ab9 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSourceFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/IndexedUebTopicSourceFactory.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 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,6 +24,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;
+import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.event.comm.bus.internal.SingleThreadedUebTopicSource;
@@ -37,6 +38,7 @@ import org.slf4j.LoggerFactory;
* Factory of UEB Source Topics indexed by topic name.
*/
class IndexedUebTopicSourceFactory implements UebTopicSourceFactory {
+ private static final Pattern COMMA_SPACE_PAT = Pattern.compile("\\s*,\\s*");
private static final String MISSING_TOPIC = "A topic must be provided";
/**
@@ -64,7 +66,7 @@ class IndexedUebTopicSourceFactory implements UebTopicSourceFactory {
return uebTopicSources.get(busTopicParams.getTopic());
}
- UebTopicSource uebTopicSource = makeSource(busTopicParams);
+ var uebTopicSource = makeSource(busTopicParams);
if (busTopicParams.isManaged()) {
uebTopicSources.put(busTopicParams.getTopic(), uebTopicSource);
@@ -85,7 +87,7 @@ class IndexedUebTopicSourceFactory implements UebTopicSourceFactory {
List<UebTopicSource> newUebTopicSources = new ArrayList<>();
synchronized (this) {
- for (String topic : readTopics.split("\\s*,\\s*")) {
+ for (String topic : COMMA_SPACE_PAT.split(readTopics)) {
addTopic(newUebTopicSources, topic, properties);
}
}
@@ -120,7 +122,7 @@ class IndexedUebTopicSourceFactory implements UebTopicSourceFactory {
String topicPrefix = PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS + "." + topic;
- PropertyUtils props = new PropertyUtils(properties, topicPrefix,
+ var props = new PropertyUtils(properties, topicPrefix,
(name, value, ex) -> logger.warn("{}: {} {} is in invalid format for topic {} ", this, name, value, topic));
String servers = properties.getProperty(topicPrefix + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX);
@@ -129,7 +131,7 @@ class IndexedUebTopicSourceFactory implements UebTopicSourceFactory {
return;
}
- UebTopicSource uebTopicSource = this.build(UebPropertyUtils.makeBuilder(props, topic, servers)
+ var uebTopicSource = this.build(UebPropertyUtils.makeBuilder(props, topic, servers)
.consumerGroup(props.getString(
PolicyEndPointProperties.PROPERTY_TOPIC_SOURCE_CONSUMER_GROUP_SUFFIX, null))
.consumerInstance(props.getString(
@@ -209,8 +211,6 @@ class IndexedUebTopicSourceFactory implements UebTopicSourceFactory {
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("IndexedUebTopicSourceFactory []");
- return builder.toString();
+ return "IndexedUebTopicSourceFactory []";
}
}
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java
index 98b6ed6f..62ac08bb 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
@@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
+import java.util.regex.Pattern;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
@@ -32,6 +33,7 @@ import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
* Noop Topic Factory.
*/
public abstract class NoopTopicFactory<T extends NoopTopicEndpoint> extends TopicBaseHashedFactory<T> {
+ private static final Pattern COMMA_SPACE_PAT = Pattern.compile("\\s*,\\s*");
/**
* Get Topics Property Name.
@@ -50,7 +52,7 @@ public abstract class NoopTopicFactory<T extends NoopTopicEndpoint> extends Topi
return new ArrayList<>();
}
- return Arrays.asList(topics.split("\\s*,\\s*"));
+ return Arrays.asList(COMMA_SPACE_PAT.split(topics));
}
/**
@@ -66,7 +68,7 @@ public abstract class NoopTopicFactory<T extends NoopTopicEndpoint> extends Topi
servers = CommInfrastructure.NOOP.toString();
}
- return new ArrayList<>(Arrays.asList(servers.split("\\s*,\\s*")));
+ return new ArrayList<>(Arrays.asList(COMMA_SPACE_PAT.split(servers)));
}
/**
@@ -74,11 +76,11 @@ public abstract class NoopTopicFactory<T extends NoopTopicEndpoint> extends Topi
*/
@Override
protected boolean isManaged(String topicName, Properties properties) {
- String managedString =
+ var managedString =
properties.getProperty(getTopicsPropertyName()
+ "." + topicName + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX);
- boolean managed = true;
+ var managed = true;
if (managedString != null && !managedString.isEmpty()) {
managed = Boolean.parseBoolean(managedString);
}
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/TopicBaseHashedFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/TopicBaseHashedFactory.java
index f53c5ea8..c785ef04 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/TopicBaseHashedFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/TopicBaseHashedFactory.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
@@ -126,7 +126,7 @@ public abstract class TopicBaseHashedFactory<T extends Topic> implements TopicBa
return this.endpoints.get(topic);
}
- T endpoint = build(servers, topic);
+ var endpoint = build(servers, topic);
if (managed) {
this.endpoints.put(topic, endpoint);
}
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java
index 0c058adb..8bf805bf 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-endpoints
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
@@ -25,7 +25,6 @@ package org.onap.policy.common.endpoints.event.comm.bus.internal;
import com.att.nsa.apiClient.http.HttpClient.ConnectionType;
import com.att.nsa.cambria.client.CambriaBatchingPublisher;
import com.att.nsa.cambria.client.CambriaClientBuilders;
-import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder;
import java.net.MalformedURLException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
@@ -79,7 +78,7 @@ public interface BusPublisher {
*/
public CambriaPublisherWrapper(BusTopicParams busTopicParams) {
- PublisherBuilder builder = new CambriaClientBuilders.PublisherBuilder();
+ var builder = new CambriaClientBuilders.PublisherBuilder();
builder.usingHosts(busTopicParams.getServers()).onTopic(busTopicParams.getTopic());
@@ -237,8 +236,13 @@ public interface BusPublisher {
try {
this.publisher.close(1, TimeUnit.SECONDS);
+
+ } catch (InterruptedException e) {
+ logger.warn("{}: CLOSE FAILED", this, e);
+ Thread.currentThread().interrupt();
+
} catch (Exception e) {
- logger.warn("{}: CLOSE FAILED because of {}", this, e.getMessage(), e);
+ logger.warn("{}: CLOSE FAILED", this, e);
}
}
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java
index f258d5d9..ea22af86 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -74,7 +74,7 @@ public class InlineUebTopicSink extends InlineBusTopicSink implements UebTopicSi
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
+ var builder = new StringBuilder();
builder.append("InlineUebTopicSink [getTopicCommInfrastructure()=").append(getTopicCommInfrastructure())
.append(", toString()=").append(super.toString()).append("]");
return builder.toString();
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
index c5f2b5bc..1c3d89d2 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2018-2019 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -128,7 +128,7 @@ public class SingleThreadedDmaapTopicSource extends SingleThreadedBusTopicSource
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
+ var builder = new StringBuilder();
builder.append("SingleThreadedDmaapTopicSource [userName=").append(userName).append(", password=")
.append((password == null || password.isEmpty()) ? "-" : password.length())
.append(", getTopicCommInfrastructure()=").append(getTopicCommInfrastructure()).append(", toString()=")
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java
index e210762d..496c38f5 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2018-2019 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -66,7 +66,7 @@ public class SingleThreadedUebTopicSource extends SingleThreadedBusTopicSource i
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
+ var builder = new StringBuilder();
builder.append("SingleThreadedUebTopicSource [getTopicCommInfrastructure()=")
.append(getTopicCommInfrastructure()).append(", toString()=").append(super.toString()).append("]");
return builder.toString();
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java
index efa06e22..dca1437b 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -159,7 +159,7 @@ public abstract class TopicBase implements Topic {
protected boolean broadcast(String message) {
List<TopicListener> snapshotListeners = this.snapshotTopicListeners();
- boolean success = true;
+ var success = true;
for (TopicListener topicListener : snapshotListeners) {
try {
topicListener.onTopicEvent(this.getTopicCommInfrastructure(), this.topic, message);
@@ -245,7 +245,7 @@ public abstract class TopicBase implements Topic {
@Override
public synchronized String[] getRecentEvents() {
- String[] events = new String[recentEvents.size()];
+ var events = new String[recentEvents.size()];
return recentEvents.toArray(events);
}