From 7b83f8fd0c093b7be871e55a1f6d96290bfcb7ec Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Fri, 2 Feb 2018 19:36:28 +0100 Subject: [PATCH] Close underlying channels --- .../slc/core/execution/http/ServiceChannel.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/org.argeo.slc.core/src/org/argeo/slc/core/execution/http/ServiceChannel.java b/org.argeo.slc.core/src/org/argeo/slc/core/execution/http/ServiceChannel.java index 3e6a1ab89..ef8febd00 100644 --- a/org.argeo.slc.core/src/org/argeo/slc/core/execution/http/ServiceChannel.java +++ b/org.argeo.slc.core/src/org/argeo/slc/core/execution/http/ServiceChannel.java @@ -54,14 +54,23 @@ public class ServiceChannel implements AsynchronousByteChannel { } @Override - /** NB: it does not close the underlying channels. */ - public void close() throws IOException { + public synchronized void close() throws IOException { + try { + in.close(); + } catch (Exception e) { + e.printStackTrace(); + } + try { + out.close(); + } catch (Exception e) { + e.printStackTrace(); + } open = false; notifyAll(); } @Override - public boolean isOpen() { + public synchronized boolean isOpen() { return open; } -- 2.39.2