@Override public <E extends IResponse<F>, F> void submit(ICommand<E, F> cmd) throws IOException { if (isClosed.get()) { RuntimeException rte = new RuntimeException("Statement is closed"); cmd.getResponse().setError(rte); throw rte; } // log.info("submit cmd " + cmd + " with argument " + cmd.getInput()); OobPacket sendPacket = createSendPacket(cmd); long id = sendPacket.getRmppMad().getCommonMad().getTransactionId(); cmd.setPacket(sendPacket); cmd.setStatement(this); conn.submitCmd(id, sendPacket, cmd); }
protected OobPacket createSendPacket(ICommand<?, ?> cmd) { OobPacket sendPacket = new OobPacket(); sendPacket.build(true); RmppMad rmppMad = cmd.prepareMad(); sendPacket.setRmppMad(rmppMad); sendPacket.fillPayloadSize(); sendPacket.setExpireTime(System.currentTimeMillis() + timeout * 1000); return sendPacket; }
private <E extends IResponse<F>, F> void debugResponse(ICommand<E, F> cmd) { E response = cmd.getResponse(); List<F> results; try { results = response.get(); if (DEBUG && results != null) { for (int i = 0; i < results.size(); i++) { System.out.println(i + " " + results.get(i)); } } } catch (Exception e) { } }