From 2a92a0e48ee7f09c38058205ebb439c515b3acee Mon Sep 17 00:00:00 2001 From: NoName11234 <47484268+NoName11234@users.noreply.github.com> Date: Sun, 21 Jan 2024 13:41:21 +0100 Subject: [PATCH] added function for closing file to WriterActiveObject --- .../typeinference/unify/WriterActiveObject.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/WriterActiveObject.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/WriterActiveObject.java index 8f63b6487..7646a44b3 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/WriterActiveObject.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/WriterActiveObject.java @@ -12,10 +12,21 @@ public class WriterActiveObject { this.writer = writer; } + public void close(){ + pool.execute(()->{ + try { + writer.close(); + } catch (IOException e) { + System.out.println(e.getMessage()); + } + }); + } + public void write(String message){ pool.execute(()->{ try { writer.write(message); + writer.flush(); } catch (IOException e) { System.out.println(e.getMessage()); }