コード例 #1
0
 @Override
 public void run() {
   try {
     initStreams();
     String line = "";
     Command command = null;
     boolean _break = false;
     while ((line = in.readLine()) != null && !_break) {
       logger.info("Message received: " + line);
       command = GsonUtils.toCommand(line);
       _break = processCommad(command);
     }
     in.close();
     out.close();
     socket.close();
     mediator.removeSession(this);
     logger.info("This session was closed, streams and socket already closed");
     join();
   } catch (IOException e) {
     logger.error(e.getLocalizedMessage());
   } catch (InterruptedException e) {
     logger.error(e.getLocalizedMessage());
   }
 }
コード例 #2
0
 @Override
 public void sendCommand(Command command) {
   mediator.sendMessage(command, this);
 }