Skip to content

Commit

Permalink
[enhancement/improveclose] Improved code inside close to have less ne…
Browse files Browse the repository at this point in the history
…sting
  • Loading branch information
Alathreon committed Aug 4, 2024
1 parent b1a3d5f commit 8dd74cb
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,19 @@ public String id() {
}

public void close() {
LOGGER.debug("Close called for session {}.", id);
try {
try {
writer.close();
} finally {
try {
reader.close();
} finally {
if(!dockerService.isDead(containerName())) {
dockerService.killContainerByName(containerName());
}
}
writer.close();
} catch (Exception ex) {
LOGGER.error("Unexpected error while closing.", ex);
}
try {
reader.close();
} catch (Exception ex) {
LOGGER.error("Unexpected error while closing.", ex);
}
try {
if(!dockerService.isDead(containerName())) {
dockerService.killContainerByName(containerName());
}
} catch (Exception ex) {
LOGGER.error("Unexpected error while closing.", ex);
Expand Down

0 comments on commit 8dd74cb

Please sign in to comment.