@Override public Object attempt(Connection cnx) throws Exception { this.failed = true; this.timedOut = false; long start = startAttempt(cnx.getStats()); try { try { attemptSend(cnx); this.failed = false; } finally { endSendAttempt(cnx.getStats(), start); } this.failed = true; try { Object result = attemptReadResponse(cnx); this.failed = false; return result; } catch (SocketTimeoutException ste) { this.failed = false; this.timedOut = true; throw ste; } } finally { endAttempt(cnx.getStats(), start); } }
@Override public Object attempt(Connection cnx) throws Exception { if (getMessage().getNumberOfParts() == 0) { return attemptRead(cnx); } this.failed = true; this.timedOut = false; long start = startAttempt(cnx.getStats()); try { try { attemptSend(cnx); this.failed = false; } finally { endSendAttempt(cnx.getStats(), start); } } finally { endAttempt(cnx.getStats(), start); } return this.failed; }
/** * Attempts to send this operation's message out on the given connection * * @param cnx the connection to use when sending * @throws Exception if the send fails */ protected void attemptSend(Connection cnx) throws Exception { setMsgTransactionId(); if (logger.isTraceEnabled(LogMarker.DISTRIBUTION_BRIDGE_SERVER_VERBOSE)) { logger.trace(LogMarker.DISTRIBUTION_BRIDGE_SERVER_VERBOSE, "Sending op={} using {}", getShortClassName(), cnx); } getMessage().setComms(cnx.getSocket(), cnx.getInputStream(), cnx.getOutputStream(), cnx.getCommBuffer(), cnx.getStats()); try { sendMessage(cnx); } finally { getMessage().unsetComms(); } }
@Override protected Object attemptReadResponse(Connection cnx) throws Exception { Message msg = createResponseMessage(); if (msg != null) { msg.setComms(cnx.getSocket(), cnx.getInputStream(), cnx.getOutputStream(), cnx.getCommBuffer(), cnx.getStats()); if (msg instanceof ChunkedMessage) { try { return processResponse(cnx, msg); } finally { msg.unsetComms(); processSecureBytes(cnx, msg); } } else { try { msg.receive(); } finally { msg.unsetComms(); processSecureBytes(cnx, msg); } return processResponse(cnx, msg); } } else { return null; } }
if (msg != null) { msg.setComms(cnx.getSocket(), cnx.getInputStream(), cnx.getOutputStream(), ((ConnectionImpl) cnx).getCommBufferForAsyncRead(), cnx.getStats()); if (msg instanceof ChunkedMessage) { try {
if (msg != null) { msg.setComms(cnx.getSocket(), cnx.getInputStream(), cnx.getOutputStream(), cnx.getCommBuffer(), cnx.getStats()); if (msg instanceof ChunkedMessage) { try {
if (msg != null) { msg.setComms(cnx.getSocket(), cnx.getInputStream(), cnx.getOutputStream(), cnx.getCommBuffer(), cnx.getStats()); if (msg instanceof ChunkedMessage) { try {