@Override public void run() { final String name = channel.getName(); try { while (!channel.isInClosed()) { Command cmd = null; try { cmd = read(); } catch (EOFException e) { IOException ioe = new IOException("Unexpected termination of the channel"); ioe.initCause(e); throw ioe; } catch (ClassNotFoundException e) { LOGGER.log(Level.SEVERE, "Unable to read a command (channel " + name + ")", e); continue; } finally { commandsReceived++; } receiver.handle(cmd); commandsExecuted++; } closeRead(); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, "I/O error in channel " + name, e); channel.terminate((InterruptedIOException) new InterruptedIOException().initCause(e)); } catch (IOException e) { LOGGER.log(Level.SEVERE, "I/O error in channel " + name, e); channel.terminate(e); } catch (RuntimeException e) { LOGGER.log(Level.SEVERE, "Unexpected error in channel " + name, e); channel.terminate( (IOException) new IOException("Unexpected reader termination").initCause(e)); throw e; } catch (Error e) { LOGGER.log(Level.SEVERE, "Unexpected error in channel " + name, e); channel.terminate( (IOException) new IOException("Unexpected reader termination").initCause(e)); throw e; } finally { channel.pipeWriter.shutdown(); } }
public void execute() { cr.methSubtract(); }
public SubtractCommand() { cr = CommandReceiver.getHandle(); }
@Override public void gameAction(ChatCommand cmd) { super.getGame().voteAction(cmd); }