Browse code

re-npp + don't retry on 8021

Thomas Cataldo authored on 10/10/2018 22:05:01
Showing 2 changed files
... ...
@@ -232,7 +232,7 @@ public class DirectorySerializer implements DataSerializer {
232 232
 	}
233 233
 
234 234
 	private List<net.bluemind.directory.hollow.datamodel.Email> toEmails(ItemValue<Mailbox> box) {
235
-		if (box == null || box.value.emails == null) {
235
+		if (box == null || box.value == null || box.value.emails == null) {
236 236
 			return Collections.emptyList();
237 237
 		}
238 238
 		return box.value.emails.stream()
... ...
@@ -77,6 +77,9 @@ public class WebsocketLink {
77 77
 		}
78 78
 
79 79
 		private void retryLater() {
80
+			if (!link.isSecure()) {
81
+				return;
82
+			}
80 83
 			logger.info("Queue retry in 1sec...");
81 84
 			new Timer("ws-retry-" + System.nanoTime(), true).schedule(new TimerTask() {
82 85
 
... ...
@@ -110,14 +113,12 @@ public class WebsocketLink {
110 110
 	private final Map<Long, ProcessHandler> execHandlers;
111 111
 	private final NodeTextListener msgListener;
112 112
 	private final NodeSocketHandler upgradeHandler;
113
-	private final String wsUrl;
114 113
 	private final HostPortClient cli;
115 114
 
116 115
 	public WebsocketLink(HostPortClient cli) {
117 116
 		this.execHandlers = new ConcurrentHashMap<>();
118 117
 		this.webSocket = new AtomicReference<>();
119 118
 		this.firstConnect = new CompletableFuture<>();
120
-		this.wsUrl = (cli.isSSL() ? "wss" : "ws") + "://" + cli.getHost() + ":" + cli.getPort() + "/ws";
121 119
 		this.cli = cli;
122 120
 		this.msgListener = new NodeTextListener(webSocket, firstConnect, this);
123 121
 		this.upgradeHandler = new NodeSocketHandler(msgListener);
... ...
@@ -126,7 +127,12 @@ public class WebsocketLink {
126 126
 		cli.setWebsocketLink(this);
127 127
 	}
128 128
 
129
+	public boolean isSecure() {
130
+		return cli.isSSL();
131
+	}
132
+
129 133
 	public void retry() {
134
+		String wsUrl = (cli.isSSL() ? "wss" : "ws") + "://" + cli.getHost() + ":" + cli.getPort() + "/ws";
130 135
 		cli.getClient().prepareGet(wsUrl).execute(upgradeHandler);
131 136
 	}
132 137