protected Receiver sendCmd( Receiver rcv, String cmd, String key, String opt, byte[] value, int casid) throws IOException { if (key.contains(" ")) { throw new IllegalArgumentException("Can't include space in a key."); } boolean retry; do { retry = false; Connection con = null; try { con = routing.getConnection(key); con.write(cmd, key, opt, value, casid); rcv.receive(con); routing.returnConnection(con); } catch (ParseException e) { routing.returnConnection(con); log.error("sendCmd(): " + e.getMessage()); throw new RuntimeException(e); } catch (Exception e) { log.error("sendCmd(): " + e.getMessage()); retry = true; log.debug("sendCmd(): retry=" + rcv.retry); routing.failCount(con); if (++rcv.retry >= maxRetry) { log.error("sendCmd(): Retry out"); throw new IOException("Retry out", e); } } } while (retry); return rcv; }