@Override public int runCmd(CommandLine cmdLine) throws Exception { ClientConfiguration adminConf = new ClientConfiguration(bkConf); BookKeeperAdmin admin = new BookKeeperAdmin(adminConf); try { admin.triggerAudit(); } finally { if (admin != null) { admin.close(); } } return 0; } }
@Override public HttpServiceResponse handle(HttpServiceRequest request) throws Exception { HttpServiceResponse response = new HttpServiceResponse(); if (HttpServer.Method.PUT == request.getMethod()) { try { bka.triggerAudit(); } catch (Exception e) { LOG.error("Meet Exception: ", e); response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Exception when do operation." + e.getMessage()); return response; } response.setCode(HttpServer.StatusCode.OK); response.setBody("Success trigger audit."); LOG.debug("response body:" + response.getBody()); return response; } else { response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Not found method. Should be PUT method"); return response; } } }