added function for closing file to WriterActiveObject

This commit is contained in:
NoName11234 2024-01-21 13:41:21 +01:00
parent b3639a3d08
commit 2a92a0e48e

View File

@ -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());
}