Skip to content

Commit 8753082

Browse files
authored
Try-Finally around service.stop in deleteSession (#41)
1 parent 880469b commit 8753082

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,11 @@ public JShellService oneTimeSession(@Nullable StartupScriptId startupScriptId)
8686

8787
public void deleteSession(String id) throws DockerException {
8888
JShellService service = jshellSessions.remove(id);
89-
service.stop();
90-
scheduler.schedule(service::close, 500, TimeUnit.MILLISECONDS);
89+
try {
90+
service.stop();
91+
} finally {
92+
scheduler.schedule(service::close, 500, TimeUnit.MILLISECONDS);
93+
}
9194
}
9295

9396
private synchronized JShellService createSession(SessionInfo sessionInfo)

0 commit comments

Comments
 (0)