aboutsummaryrefslogtreecommitdiffstats
path: root/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java
diff options
context:
space:
mode:
Diffstat (limited to 'datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java')
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java48
1 files changed, 24 insertions, 24 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java
index 125c50d8..715c5e14 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java
@@ -24,16 +24,18 @@
package org.onap.dmaap.datarouter.provisioning;
+import static org.onap.dmaap.datarouter.provisioning.utils.HttpServletUtils.sendResponseError;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.net.HttpURLConnection;
import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
-import java.util.Vector;
-
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
import org.json.JSONException;
import org.json.JSONObject;
import org.onap.dmaap.datarouter.authz.AuthorizationResponse;
@@ -41,11 +43,6 @@ import org.onap.dmaap.datarouter.provisioning.beans.EventLogRecord;
import org.onap.dmaap.datarouter.provisioning.beans.Subscription;
import org.onap.dmaap.datarouter.provisioning.eelf.EelfMsgs;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-import static org.onap.dmaap.datarouter.provisioning.utils.HttpServletUtils.sendResponseError;
-
/**
* This servlet handles provisioning for the <subscriptionURL> which is generated by the provisioning server to
* handle the inspection, modification, and deletion of a particular subscription to a feed. It supports DELETE to
@@ -515,16 +512,16 @@ public class SubscriptionServlet extends ProxyServlet {
* A Thread class used to serially send reset notifications to all nodes in the DR network, when a POST is received
* for a subscription.
*/
- public class SubscriberNotifyThread extends Thread {
+ public static class SubscriberNotifyThread extends Thread {
- public static final String URL_TEMPLATE = "http://%s/internal/resetSubscription/%d";
- private List<String> urls = new Vector<>();
+ static final String URL_TEMPLATE = "http://%s/internal/resetSubscription/%d";
+ private List<String> urls = new ArrayList<>();
- public SubscriberNotifyThread() {
+ SubscriberNotifyThread() {
setName("SubscriberNotifyThread");
}
- public void resetSubscription(int subid) {
+ void resetSubscription(int subid) {
for (String nodename : BaseServlet.getNodes()) {
String u = String.format(URL_TEMPLATE, nodename, subid);
urls.add(u);
@@ -533,23 +530,26 @@ public class SubscriptionServlet extends ProxyServlet {
@Override
public void run() {
-
try {
while (!urls.isEmpty()) {
- String u = urls.remove(0);
- try {
- URL url = new URL(u);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.connect();
- conn.getContentLength(); // Force the GET through
- conn.disconnect();
- } catch (IOException e) {
- intlogger.info("PROV0194 Error accessing URL: " + u + ": " + e.getMessage(), e);
- }
+ String url = urls.remove(0);
+ forceGetThrough(url);
}
} catch (Exception e) {
intlogger.warn("PROV0195 Caught exception in SubscriberNotifyThread: " + e.getMessage(), e);
}
}
+
+ private void forceGetThrough(String url) {
+ try {
+ URL urlObj = new URL(url);
+ HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();
+ conn.connect();
+ conn.getContentLength(); // Force the GET through
+ conn.disconnect();
+ } catch (IOException e) {
+ intlogger.info("PROV0194 Error accessing URL: " + url + ": " + e.getMessage(), e);
+ }
+ }
}
}