Changed "restart" in interpreter tab to restart all of interpreterGroups in that interpreterSetting

This commit is contained in:
Jongyoul Lee 2017-03-17 23:46:43 +09:00
parent bcccbb98cf
commit 8341348d68
3 changed files with 14 additions and 4 deletions

View file

@ -190,7 +190,11 @@ public class InterpreterRestApi {
RestartInterpreterRequest request = gson.fromJson(message, RestartInterpreterRequest.class);
String noteId = request == null ? null : request.getNoteId();
interpreterSettingManager.restart(settingId, noteId, SecurityUtils.getPrincipal());
if (null == noteId) {
interpreterSettingManager.close(setting);
} else {
interpreterSettingManager.restart(settingId, noteId, SecurityUtils.getPrincipal());
}
notebookServer.clearParagraphRuntimeInfo(setting);
} catch (InterpreterException e) {

View file

@ -274,9 +274,11 @@ public class InterpreterSetting {
}
void closeAndRemoveAllInterpreterGroups() {
HashSet<String> groupsToRemove = new HashSet<>(interpreterGroupRef.keySet());
for (String key : groupsToRemove) {
closeAndRemoveInterpreterGroupByNoteId(key);
for (String processKey : new HashSet<>(interpreterGroupRef.keySet())) {
InterpreterGroup interpreterGroup = interpreterGroupRef.get(processKey);
for (String sessionKey : new HashSet<>(interpreterGroup.keySet())) {
interpreterGroup.close(interpreterGroupRef, processKey, sessionKey);
}
}
}

View file

@ -1059,6 +1059,10 @@ public class InterpreterSettingManager {
}
}
public void close(InterpreterSetting interpreterSetting) {
interpreterSetting.closeAndRemoveAllInterpreterGroups();
}
public void close() {
List<Thread> closeThreads = new LinkedList<>();
synchronized (interpreterSettings) {