LOG.warning("Received ZMQ.HANDSHAKE_RESPONSE for unknown handshake..."
+ senderUrl + " : " + token);
}
return;
} else {
final ObjectCache sessionCache = ObjectCache.get("ZMQSessions");
if (!sessionCache.containsKey(key)
&& host.getAgent(agentId).hasPrivate()) {
final AsyncCallbackQueue<String> callbacks = host
.getCallbackQueue("zmqHandshakes", String.class);
SyncCallback<String> callback = new SyncCallback<String>();
callbacks.push(key, "", callback);
service.sendAsync(ZMQ.HANDSHAKE, token.toString(), zmqUrl,
senderUrl, token.getTime(), null);
String retToken = null;
try {
retToken = callback.get();
} catch (Exception e) {
}
if (token.getToken().equals(retToken)) {
sessionCache.put(key, true);
} else {
LOG.warning("Failed to complete handshake!");
return;
}
}