/** * Test hook to handle an exception that happened on the given connection */ public void processException(Throwable e, Connection con) { executor.handleException(e, con, 0, false); }
protected void handleException(Op op, Throwable e, Connection conn, int retryCount, boolean finalAttempt, boolean timeoutFatal) throws CacheRuntimeException { if (op instanceof AuthenticateUserOp.AuthenticateUserOpImpl) { if (e instanceof GemFireSecurityException) { throw (GemFireSecurityException) e; } else if (e instanceof ServerRefusedConnectionException) { throw (ServerRefusedConnectionException) e; } } handleException(e, conn, retryCount, finalAttempt, timeoutFatal); }
protected void handleException(Throwable e, Connection conn, int retryCount, boolean finalAttempt) { handleException(e, conn, retryCount, finalAttempt, false/* timeoutFatal */); }
/** * 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); } }
} catch (Exception e) { try { handleException(e, primary, 0, false); } catch (RuntimeException e2) { lastException = e2; } catch (Exception e) { try { handleException(e, conn, 0, false); } catch (RuntimeException e2) { lastException = e2;
@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); } } } }
executeWithPossibleReAuthentication(conn, op); } catch (Exception e) { handleException(e, conn, 0, false); handleException(e, primary, 0, finalAttempt); primary = queueManager.getAllConnections().getPrimary();
|| (t instanceof GemFireSecurityException) || (t instanceof ServerOperationException) || (t instanceof TransactionException) || (t instanceof CancelException)) { handleException(t, conn, retryCount, finalAttempt, timeoutFatal); return; } else if (e instanceof ServerOperationException) { if (t instanceof InternalFunctionInvocationTargetException) { handleException(t, conn, retryCount, finalAttempt, timeoutFatal); return; } else {
handleException(e, conn, attempt, attempt >= retries && retries != -1); if (null == attemptedServers) { handleException(e, conn, attempt, true); } else { conn = connectionManager.exchangeConnection(conn, attemptedServers, serverTimeout); } catch (NoAvailableServersException nse2) { handleException(e, conn, attempt, true);
handleException(e, conn, 0, true);