src/main/java/org/apache/hadoop/hdfs/server/namenode/analytics/web/NamenodeAnalyticsMethods.java
@GET
  @Path("/queryGuard")
  @Produces({MediaType.TEXT_PLAIN})
  public Response queryGuard() {
    try {
      before();
      final AtomicBoolean cancelRequest = (AtomicBoolean) context.getAttribute(NNA_CANCEL_REQUEST);
      boolean guarding = !cancelRequest.get();
      cancelRequest.set(guarding);
      if (guarding) {
        return Response.ok(
                "Guarding against queries. All queries after current processing will be killed.",
                MediaType.TEXT_PLAIN)
            .build();
      } else {
        return Response.ok("All queries allowed.", MediaType.TEXT_PLAIN).build();
      }
    } catch (Exception ex) {
      return handleException(ex);
    } finally {
      after();
    }
  }
/** QUERYGUARD endpoint is an admin-level endpoint meant to kill all running analysis queries. */
QUERYGUARD endpoint is an admin-level endpoint meant to kill all running analysis queries.
QUERYGUARD endpoint is an admin - level endpoint meant to kill all running analysis queries .
@GET
  @Path("/queryGuard")
  @Produces({MediaType.TEXT_PLAIN})
  public Response queryGuard() {
    try {
      before();
      final AtomicBoolean cancelRequest = (AtomicBoolean) context.getAttribute(NNA_CANCEL_REQUEST);
      boolean guarding = !cancelRequest.get();
      cancelRequest.set(guarding);
      if (guarding) {
        return Response.ok(
                "Guarding against queries. All queries after current processing will be killed.",
                MediaType.TEXT_PLAIN)
            .build();
      } else {
        return Response.ok("All queries allowed.", MediaType.TEXT_PLAIN).build();
      }
    } catch (Exception ex) {
      return handleException(ex);
    } finally {
      after();
    }
  }
@ GET @ Path ( "/queryGuard" ) @ Produces ( { MediaType . TEXT_PLAIN } ) public Response queryGuard ( ) { try { before ( ) ; final AtomicBoolean cancelRequest = ( AtomicBoolean ) context . getAttribute ( NNA_CANCEL_REQUEST ) ; boolean guarding = ! cancelRequest . get ( ) ; cancelRequest . set ( guarding ) ; if ( guarding ) { return Response . ok ( "Guarding against queries. All queries after current processing will be killed." , MediaType . TEXT_PLAIN ) . build ( ) ; } else { return Response . ok ( "All queries allowed." , MediaType . TEXT_PLAIN ) . build ( ) ; } } catch ( Exception ex ) { return handleException ( ex ) ; } finally { after ( ) ; } }
QUERYGUARD endpoint is an admin-level endpoint meant to kill all running analysis queries.
QUERYGUARD endpoint is an admin - level endpoint meant to kill all running analysis queries .