protected InvocationResult invokeInternal(Method method, Object[] args) throws Throwable { InvocationResult result; try { Object methodResult = method.invoke(base, args); result = new InvocationResult(true, methodResult, null); } catch (UndeclaredThrowableException e) { throw e.getCause(); } catch (InvocationTargetException e) { if (e.getCause() instanceof HiveSQLException) { HiveSQLException hiveExc = (HiveSQLException) e.getCause(); Throwable cause = hiveExc.getCause(); if ((cause instanceof TApplicationException) || (cause instanceof TProtocolException) || (cause instanceof TTransportException)) { result = new InvocationResult(false, null, hiveExc); } else { throw hiveExc; } } else { throw e.getCause(); } } return result; }
fail("Expected to throw exception for invalid port"); } catch (HiveSQLException sqlExc) { assertTrue(sqlExc.getCause() instanceof TTransportException); assertTrue(sqlExc.getMessage().contains("3")); } catch (HiveSQLException exc) { exc.printStackTrace(); assertTrue(exc.getCause() instanceof TException); assertEquals(1, RetryingThriftCLIServiceClientTest.handlerInst.callCount); assertEquals(3, RetryingThriftCLIServiceClientTest.handlerInst.connectCount);
/** * Checks if is session invalid. * * @param exc the exc * @param sessionHandle the session handle * @return true, if is session invalid */ protected boolean isSessionInvalid(HiveSQLException exc, SessionHandle sessionHandle) { if (exc.getMessage().contains("Invalid SessionHandle") && exc.getMessage().contains(sessionHandle.toString())) { return true; } // Check if there is underlying cause if (exc.getCause() instanceof HiveSQLException) { isSessionInvalid((HiveSQLException) exc.getCause(), sessionHandle); } return false; }
/** * Checks if is session invalid. * * @param exc the exc * @param sessionHandle the session handle * @return true, if is session invalid */ protected boolean isSessionInvalid(HiveSQLException exc, SessionHandle sessionHandle) { if (exc.getMessage().contains("Invalid SessionHandle") && exc.getMessage().contains(sessionHandle.toString())) { return true; } // Check if there is underlying cause if (exc.getCause() instanceof HiveSQLException) { isSessionInvalid((HiveSQLException) exc.getCause(), sessionHandle); } return false; }
/** * Check invalid operation. * * @param queryHandle the query handle * @param exc the exc */ protected void checkInvalidOperation(QueryHandle queryHandle, HiveSQLException exc) { final OperationHandle operation = hiveHandles.get(queryHandle); if (operation == null) { log.info("No hive operation available for {}", queryHandle); return; } if (exc.getMessage() != null && exc.getMessage().contains("Invalid OperationHandle:") && exc.getMessage().contains(operation.toString())) { log.info("Hive operation {} for query {} has become invalid", operation, queryHandle); hiveHandles.remove(queryHandle); return; } if (exc.getCause() instanceof HiveSQLException) { checkInvalidOperation(queryHandle, (HiveSQLException) exc.getCause()); } return; }
/** * Check invalid operation. * * @param queryHandle the query handle * @param exc the exc */ protected void checkInvalidOperation(QueryHandle queryHandle, HiveSQLException exc) { final OperationHandle operation = hiveHandles.get(queryHandle); if (operation == null) { log.info("No hive operation available for {}", queryHandle); return; } if (exc.getMessage() != null && exc.getMessage().contains("Invalid OperationHandle:") && exc.getMessage().contains(operation.toString())) { log.info("Hive operation {} for query {} has become invalid", operation, queryHandle); hiveHandles.remove(queryHandle); return; } if (exc.getCause() instanceof HiveSQLException) { checkInvalidOperation(queryHandle, (HiveSQLException) exc.getCause()); } return; }
protected InvocationResult invokeInternal(Method method, Object[] args) throws Throwable { InvocationResult result; try { Object methodResult = method.invoke(base, args); result = new InvocationResult(true, methodResult, null); } catch (UndeclaredThrowableException e) { throw e.getCause(); } catch (InvocationTargetException e) { if (e.getCause() instanceof HiveSQLException) { HiveSQLException hiveExc = (HiveSQLException) e.getCause(); Throwable cause = hiveExc.getCause(); if ((cause instanceof TApplicationException) || (cause instanceof TProtocolException) || (cause instanceof TTransportException)) { result = new InvocationResult(false, null, hiveExc); } else { throw hiveExc; } } else { throw e.getCause(); } } return result; }
protected InvocationResult invokeInternal(Method method, Object[] args) throws Throwable { InvocationResult result; try { Object methodResult = method.invoke(base, args); result = new InvocationResult(true, methodResult, null); } catch (UndeclaredThrowableException e) { throw e.getCause(); } catch (InvocationTargetException e) { if (e.getCause() instanceof HiveSQLException) { HiveSQLException hiveExc = (HiveSQLException) e.getCause(); Throwable cause = hiveExc.getCause(); if ((cause instanceof TApplicationException) || (cause instanceof TProtocolException) || (cause instanceof TTransportException)) { result =new InvocationResult(false, null, hiveExc); } else { throw hiveExc; } } else { throw e.getCause(); } } return result; }