@Test public void testSystemHealthErrorInterpretation() { for (RouterErrorCode errorCode : RouterErrorCode.values()) { switch (errorCode) { case InvalidBlobId: case InvalidPutArgument: case BlobTooLarge: case BadInputChannel: case BlobDeleted: case BlobDoesNotExist: case BlobAuthorizationFailure: case BlobExpired: case RangeNotSatisfiable: case ChannelClosed: case BlobUpdateNotAllowed: Assert.assertFalse(RouterUtils.isSystemHealthError(new RouterException("", errorCode))); break; default: Assert.assertTrue(RouterUtils.isSystemHealthError(new RouterException("", errorCode))); break; } } Assert.assertTrue(RouterUtils.isSystemHealthError(new Exception())); Assert.assertFalse(RouterUtils.isSystemHealthError(Utils.convertToClientTerminationException(new Exception()))); }
static boolean isSystemHealthError(Exception exception) { boolean isSystemHealthError = true; boolean isInternalError = false; if (exception instanceof RouterException) { RouterErrorCode routerErrorCode = ((RouterException) exception).getErrorCode(); switch (routerErrorCode) { case InvalidBlobId: case InvalidPutArgument: case BlobTooLarge: case BadInputChannel: case BlobDeleted: case BlobExpired: case BlobAuthorizationFailure: case BlobDoesNotExist: case RangeNotSatisfiable: case ChannelClosed: case BlobUpdateNotAllowed: isSystemHealthError = false; break; case UnexpectedInternalError: isInternalError = true; break; } } else if (Utils.isPossibleClientTermination(exception)) { isSystemHealthError = false; } if (isSystemHealthError) { if (isInternalError) { logger.error("Router operation met with a system health error: ", exception); } else { logger.warn("Router operation error: {}", exception.toString()); } } return isSystemHealthError; }
RouterUtils { static boolean isSystemHealthError(Exception exception) { boolean isSystemHealthError = true; boolean isInternalError = false; if (exception instanceof RouterException) { RouterErrorCode routerErrorCode = ((RouterException) exception).getErrorCode(); switch (routerErrorCode) { case InvalidBlobId: case InvalidPutArgument: case BlobTooLarge: case BadInputChannel: case BlobDeleted: case BlobExpired: case BlobAuthorizationFailure: case BlobDoesNotExist: case RangeNotSatisfiable: case ChannelClosed: case BlobUpdateNotAllowed: isSystemHealthError = false; break; case UnexpectedInternalError: isInternalError = true; break; } } else if (Utils.isPossibleClientTermination(exception)) { isSystemHealthError = false; } if (isSystemHealthError) { if (isInternalError) { logger.error("Router operation met with a system health error: ", exception); } else { logger.warn("Router operation error: {}", exception.toString()); } } return isSystemHealthError; } }
RouterUtils { static boolean isSystemHealthError(Exception exception) { boolean isSystemHealthError = true; boolean isInternalError = false; if (exception instanceof RouterException) { RouterErrorCode routerErrorCode = ((RouterException) exception).getErrorCode(); switch (routerErrorCode) { case InvalidBlobId: case InvalidPutArgument: case BlobTooLarge: case BadInputChannel: case BlobDeleted: case BlobExpired: case BlobAuthorizationFailure: case BlobDoesNotExist: case RangeNotSatisfiable: case ChannelClosed: case BlobUpdateNotAllowed: isSystemHealthError = false; break; case UnexpectedInternalError: isInternalError = true; break; } } else if (Utils.isPossibleClientTermination(exception)) { isSystemHealthError = false; } if (isSystemHealthError) { if (isInternalError) { logger.error("Router operation met with a system health error: ", exception); } else { logger.warn("Router operation error: {}", exception.toString()); } } return isSystemHealthError; }  }
RouterUtils { static boolean isSystemHealthError(Exception exception) { boolean isSystemHealthError = true; boolean isInternalError = false; if (exception instanceof RouterException) { RouterErrorCode routerErrorCode = ((RouterException) exception).getErrorCode(); switch (routerErrorCode) { case InvalidBlobId: case InvalidPutArgument: case BlobTooLarge: case BadInputChannel: case BlobDeleted: case BlobExpired: case BlobAuthorizationFailure: case BlobDoesNotExist: case RangeNotSatisfiable: case ChannelClosed: case BlobUpdateNotAllowed: isSystemHealthError = false; break; case UnexpectedInternalError: isInternalError = true; break; } } else if (Utils.isPossibleClientTermination(exception)) { isSystemHealthError = false; } if (isSystemHealthError) { if (isInternalError) { logger.error("Router operation met with a system health error: ", exception); } else { logger.warn("Router operation error: {}", exception.toString()); } } return isSystemHealthError; }   }
RouterUtils { static boolean isSystemHealthError(Exception exception) { boolean isSystemHealthError = true; boolean isInternalError = false; if (exception instanceof RouterException) { RouterErrorCode routerErrorCode = ((RouterException) exception).getErrorCode(); switch (routerErrorCode) { case InvalidBlobId: case InvalidPutArgument: case BlobTooLarge: case BadInputChannel: case BlobDeleted: case BlobExpired: case BlobAuthorizationFailure: case BlobDoesNotExist: case RangeNotSatisfiable: case ChannelClosed: case BlobUpdateNotAllowed: isSystemHealthError = false; break; case UnexpectedInternalError: isInternalError = true; break; } } else if (Utils.isPossibleClientTermination(exception)) { isSystemHealthError = false; } if (isSystemHealthError) { if (isInternalError) { logger.error("Router operation met with a system health error: ", exception); } else { logger.warn("Router operation error: {}", exception.toString()); } } return isSystemHealthError; }    }