mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
remove 074098eeb8ace6545c159d26657768079ae4b208 and ZeppelinHubConnection
since same functionality is already done by ZeppelinHubHeartbeat job
This commit is contained in:
parent
efcfca3941
commit
6c3aff2f1b
2 changed files with 5 additions and 58 deletions
|
|
@ -32,7 +32,6 @@ import org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.protocol.Zeppelin
|
|||
import org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.protocol.ZeppelinhubMessage;
|
||||
import org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.scheduler.SchedulerService;
|
||||
import org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.scheduler.ZeppelinHubHeartbeat;
|
||||
import org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.scheduler.ZeppelinhubConnection;
|
||||
import org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.session.ZeppelinhubSession;
|
||||
import org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.utils.ZeppelinhubUtils;
|
||||
import org.apache.zeppelin.notebook.socket.Message;
|
||||
|
|
@ -112,16 +111,7 @@ public class ZeppelinhubClient {
|
|||
LOG.error("Cannot stop zeppelinhub websocket client", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void reconnectIfConectionLost() {
|
||||
if (!isConnectedToZeppelinhub()) {
|
||||
LOG.debug("Zeppelinhub connection is not open, opening it");
|
||||
zeppelinhubSession = connect();
|
||||
} else {
|
||||
LOG.debug("Connection to Zeppelinhub is still open");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getToken() {
|
||||
return this.zeppelinhubToken;
|
||||
}
|
||||
|
|
@ -130,6 +120,10 @@ public class ZeppelinhubClient {
|
|||
if (!isConnectedToZeppelinhub()) {
|
||||
LOG.info("Zeppelinhub connection is not open, opening it");
|
||||
zeppelinhubSession = connect();
|
||||
if (zeppelinhubSession == ZeppelinhubSession.EMPTY) {
|
||||
LOG.warn("While connecting to ZeppelinHub received empty session, cannot send the message");
|
||||
return;
|
||||
}
|
||||
}
|
||||
zeppelinhubSession.sendByFuture(msg);
|
||||
}
|
||||
|
|
@ -168,7 +162,6 @@ public class ZeppelinhubClient {
|
|||
|
||||
private void addRoutines() {
|
||||
schedulerService.add(ZeppelinHubHeartbeat.newInstance(this), 10, 23);
|
||||
schedulerService.add(ZeppelinhubConnection.newInstance(this), 5, 10);
|
||||
}
|
||||
|
||||
public void handleMsgFromZeppelinHub(String message) {
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.scheduler;
|
||||
|
||||
import org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.ZeppelinhubClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Check and test if zeppelinhub connection is still open.
|
||||
*
|
||||
*/
|
||||
public class ZeppelinhubConnection implements Runnable {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ZeppelinhubConnection.class);
|
||||
private ZeppelinhubClient client;
|
||||
|
||||
public static ZeppelinhubConnection newInstance(ZeppelinhubClient client) {
|
||||
return new ZeppelinhubConnection(client);
|
||||
}
|
||||
|
||||
private ZeppelinhubConnection(ZeppelinhubClient client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
LOG.debug("Checking if Zeppelinbhub connection is open");
|
||||
client.reconnectIfConectionLost();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in a new issue