@Override public boolean equals(Object o) { return o == this || o instanceof PrepareCommand && equalTo((PrepareCommand) o); }
@Override public int hashCode() { return hashTo(); }
protected boolean equalTo(PrepareCommand that) { return super.equalTo(that); } }
PrepareCommand prepare = new PrepareCommand(); prepare.setName(name); } else { StartCommand start = new StartCommand(); start.setName(name); controller.writeCommand(start);
private void sendAbortCommand() throws Exception { AbortCommand abort = new AbortCommand(); abort.setName(name); controller.writeCommand(abort); } }
@Override public int hashCode() { return hashTo(); }
@Override public int hashCode() { return hashTo(); }
@Override public boolean equals(Object o) { return o == this || o instanceof StartCommand && equalTo((StartCommand) o); }
@Override public boolean equals(Object o) { return o == this || o instanceof AbortCommand && equalTo((AbortCommand) o); }
private void writeCommand(StartCommand start) throws Exception { OutputStream bytesOut = connection.getOutputStream(); CharsetEncoder encoder = UTF_8.newEncoder(); Writer textOut = new OutputStreamWriter(bytesOut, encoder); String name = start.getName(); textOut.append("START\n"); textOut.append(format("name:%s\n", name)); textOut.append("\n"); textOut.flush(); }
private void writeCommand(AbortCommand abort) throws IOException, CharacterCodingException { OutputStream bytesOut = connection.getOutputStream(); CharsetEncoder encoder = UTF_8.newEncoder(); Writer textOut = new OutputStreamWriter(bytesOut, encoder); String name = abort.getName(); textOut.append("ABORT\n"); textOut.append(format("name:%s\n", name)); textOut.append("\n"); textOut.flush(); }
private void writeCommand(PrepareCommand prepare) throws Exception { OutputStream bytesOut = connection.getOutputStream(); CharsetEncoder encoder = UTF_8.newEncoder(); Writer textOut = new OutputStreamWriter(bytesOut, encoder); String name = prepare.getName(); textOut.append("PREPARE\n"); textOut.append(format("name:%s\n", name)); textOut.append("\n"); textOut.flush(); }
@Override public void writeCommand(Command command) throws Exception { checkConnected(); switch (command.getKind()) { case PREPARE: writeCommand((PrepareCommand) command); break; case START: writeCommand((StartCommand) command); break; case ABORT: writeCommand((AbortCommand) command); break; default: throw new IllegalArgumentException("Urecognized command kind: " + command.getKind()); } }
protected boolean equalTo(StartCommand that) { return super.equalTo(that); } }