moresandeep commented on code in PR #742:
URL: https://github.com/apache/knox/pull/742#discussion_r1146883382


##########
gateway-service-webhdfs/src/main/java/org/apache/knox/gateway/hdfs/dispatch/AbstractHdfsHaDispatch.java:
##########
@@ -59,33 +59,19 @@ protected void executeRequest(HttpUriRequest 
outboundRequest, HttpServletRequest
       try {
          inboundResponse = executeOutboundRequest(outboundRequest);
          writeOutboundResponse(outboundRequest, inboundRequest, 
outboundResponse, inboundResponse);
-      } catch (StandbyException e) {
+      } catch (StandbyException | SafeModeException | IOException e) {
         /* if non-idempotent requests are not allowed to failover */
-        if(!failoverNonIdempotentRequestEnabled && 
idempotentRequests.stream().anyMatch(outboundRequest.getMethod()::equalsIgnoreCase))
 {
-          
LOG.cannotFailoverToNonIdempotentRequest(outboundRequest.getMethod());
+        if(!failoverNonIdempotentRequestEnabled && 
nonIdempotentRequests.stream().anyMatch(outboundRequest.getMethod()::equalsIgnoreCase))
 {
+          LOG.cannotFailoverNonIdempotentRequest(outboundRequest.getMethod(), 
e.toString());
           throw e;
         } else {
-          LOG.errorReceivedFromStandbyNode(e);
-          failoverRequest(outboundRequest, inboundRequest, outboundResponse,
-              inboundResponse, e);
-        }
-      } catch (SafeModeException e) {
-        /* if non-idempotent requests are not allowed to failover */
-        if(!failoverNonIdempotentRequestEnabled && 
idempotentRequests.stream().anyMatch(outboundRequest.getMethod()::equalsIgnoreCase))
 {
-          
LOG.cannotFailoverToNonIdempotentRequest(outboundRequest.getMethod());
-          throw e;
-        } else {
-          LOG.errorReceivedFromSafeModeNode(e);
-          failoverRequest(outboundRequest, inboundRequest, outboundResponse,
-              inboundResponse, e);
-        }
-      } catch (IOException e) {
-        /* if non-idempotent requests are not allowed to failover */
-        if(!failoverNonIdempotentRequestEnabled && 
idempotentRequests.stream().anyMatch(outboundRequest.getMethod()::equalsIgnoreCase))
 {
-          
LOG.cannotFailoverToNonIdempotentRequest(outboundRequest.getMethod());
-          throw e;
-        } else {
-          LOG.errorConnectingToServer(outboundRequest.getURI().toString(), e);
+          if(e instanceof StandbyException) {

Review Comment:
   Nope, it's at the bottom, below the if else statement (new refactored into a 
method).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to