diff options
-rw-r--r-- | src/main/java/net/libertacasa/pubsh/web/SchedulerBean.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/net/libertacasa/pubsh/web/SchedulerBean.java b/src/main/java/net/libertacasa/pubsh/web/SchedulerBean.java index 26408df..135a424 100644 --- a/src/main/java/net/libertacasa/pubsh/web/SchedulerBean.java +++ b/src/main/java/net/libertacasa/pubsh/web/SchedulerBean.java @@ -29,9 +29,13 @@ public class SchedulerBean { return Tasks.oneTime("shell-removal") .execute((instance, ctx) -> { System.out.printf("Running container removal task - Instance: %s, ctx: %s\n", instance, ctx); - String username = instance.getId().split("&")[0]; - String containerid = instance.getId().split("&")[1]; - Docker.deleteShell(username, containerid); + try { + String username = instance.getId().split("&")[0]; + String containerid = instance.getId().split("&")[1]; + Docker.deleteShell(username, containerid); + } catch (com.github.dockerjava.api.exception.NotFoundException exception) { + System.out.printf("Container does not exist\n"); + } }); } |