use of org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.listener.ZeppelinWebsocket in project zeppelin by apache.
the class ZeppelinClient method openNoteSession.
private Session openNoteSession(String noteId) {
ClientUpgradeRequest request = new ClientUpgradeRequest();
ZeppelinWebsocket socket = new ZeppelinWebsocket(noteId);
Future<Session> future = null;
Session session = null;
try {
future = wsClient.connect(socket, zeppelinWebsocketUrl, request);
session = future.get();
} catch (IOException | InterruptedException | ExecutionException e) {
LOG.error("Couldn't establish websocket connection to Zeppelin ", e);
return session;
}
if (notesConnection.containsKey(noteId)) {
session.close();
session = notesConnection.get(noteId);
} else {
String getNote = serialize(zeppelinGetNoteMsg(noteId));
session.getRemote().sendStringByFuture(getNote);
notesConnection.put(noteId, session);
}
return session;
}
Aggregations