/** * Used by GatewayBatchOp */ @Override public Object executeOn(Connection conn, Op op, boolean timeoutFatal) { try { return executeWithPossibleReAuthentication(conn, op); } catch (Exception e) { // This method will throw an exception if we need to stop // It also unsets the threadlocal connection and notifies // the connection manager if there are failures. handleException(op, e, conn, 0, true, timeoutFatal); // this shouldn't actually be reached, handle exception will throw something throw new ServerConnectivityException("Received error connecting to server", e); } }
if (primary != null) { try { executeWithPossibleReAuthentication(primary, op); } catch (Exception e) { try { Connection conn = (Connection) backups.get(i); try { executeWithPossibleReAuthentication(conn, op); } catch (Exception e) { try {
@Override public Object executeOnPrimary(Op op) { if (queueManager == null) { throw new SubscriptionNotEnabledException(); } HashSet attemptedPrimaries = new HashSet(); while (true) { Connection primary = queueManager.getAllConnections().getPrimary(); try { return executeWithPossibleReAuthentication(primary, op); } catch (Exception e) { boolean finalAttempt = !attemptedPrimaries.add(primary.getServer()); handleException(e, primary, 0, finalAttempt); // we shouldn't reach this code, but just in case if (finalAttempt) { throw new ServerConnectivityException("Tried the same primary server twice.", e); } } } }
Connection conn = (Connection) backups.get(i); try { executeWithPossibleReAuthentication(conn, op); } catch (Exception e) { handleException(e, conn, 0, false); logger.trace(LogMarker.BRIDGE_SERVER_VERBOSE, "sending {} to primary: {}", op, primary); return executeWithPossibleReAuthentication(primary, op); } catch (Exception e) { if (logger.isTraceEnabled(LogMarker.BRIDGE_SERVER_VERBOSE)) {
Object result = executeWithPossibleReAuthentication(conn, op); success = true; return result;
return executeWithPossibleReAuthentication(conn, op); } catch (Exception e) { success = false;