@@ -0,0 +1,1086 @@
+package ru.nsu.ccfit.bogush;%0A%0Aimport org.apache.logging.log4j.LogManager;%0Aimport org.apache.logging.log4j.Logger;%0Aimport ru.nsu.ccfit.bogush.msg.Message;%0A%0Aimport java.io.IOException;%0Aimport java.util.concurrent.LinkedBlockingQueue;%0A%0Apublic class SocketWriter %7B%0A%09private static final Logger logger = LogManager.getLogger();%0A%0A%09private Thread thread;%0A%09private LinkedBlockingQueue%3CMessage%3E messageQueue;%0A%0A%09public SocketWriter(MessageSender messageSender, int queueCapacity) %7B%0A%09%09this.messageQueue = new LinkedBlockingQueue%3C%3E(queueCapacity);%0A%09%09thread = new Thread(() -%3E %7B%0A%09%09%09while (!Thread.interrupted()) %7B%0A%09%09%09%09try %7B%0A%09%09%09%09%09messageSender.sendMessage(messageQueue.take());%0A%09%09%09%09%7D catch (IOException e) %7B%0A%09%09%09%09%09logger.error(%22Couldn't send message%22);%0A%09%09%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09%09%09logger.trace(%22Interrupted%22);%0A%09%09%09%09%09break;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D);%0A%09%7D%0A%0A%09public void start() %7B%0A%09%09logger.trace(%22Start%22);%0A%09%09thread.start();%0A%09%7D%0A%0A%09public void stop() %7B%0A%09%09logger.trace(%22Stop%22);%0A%09%09thread.interrupt();%0A%09%7D%0A%0A%09public void write(Message message) throws InterruptedException %7B%0A%09%09messageQueue.put(message);%0A%09%7D%0A%7D%0A

Implement socket writer