Skip to content

Commit fd03299

Browse files
committed
Lights improvments
1 parent 4839767 commit fd03299

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

JShellAPI/src/main/java/org/togetherjava/jshellapi/service/JShellService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,17 @@ public String id() {
182182
@Override
183183
public void close() {
184184
try {
185+
dockerService.killContainerByName(containerName());
185186
try {
186187
writer.close();
187188
} finally {
188189
reader.close();
189190
}
190-
dockerService.killContainerByName(containerName());
191191
} catch(IOException ex) {
192192
throw new RuntimeException(ex);
193+
} finally {
194+
sessionService.notifyDeath(id);
193195
}
194-
sessionService.notifyDeath(id);
195196
}
196197

197198
@Override

JShellAPI/src/main/java/org/togetherjava/jshellapi/service/JShellSessionService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ private void initScheduler() {
3939
}
4040
void notifyDeath(String id) {
4141
JShellService shellService = jshellSessions.get(id);
42+
if(shellService == null) return;
4243
if(!shellService.isClosed()) {
4344
throw new RuntimeException("JShell Service isn't dead when it should for id " + id);
4445
}

0 commit comments

Comments
 (0)