@Override public void doAuthAction(ActionRequest request, ActionResponse response) throws Exception { String collectionId = request.getParameter("collectionId"); JobService jobService = ServiceManager.getInstance().getService(JobService.class); MasterCollectionFullIndexingStepApplyJob masterCollectionIndexingJob = new MasterCollectionFullIndexingStepApplyJob(); masterCollectionIndexingJob.setArgs(collectionId); ResultFuture jobResult = jobService.offer(masterCollectionIndexingJob); Writer writer = response.getWriter(); ResponseWriter resultWriter = getDefaultResponseWriter(writer); resultWriter.object().key("collectionId").value(collectionId); if (jobResult != null) { resultWriter.key("status").value("0"); } else { resultWriter.key("status").value("1"); } resultWriter.endObject(); resultWriter.done(); }
@Override public JobResult doRun() throws FastcatSearchException { int nodeSize = nodeList.size(); NodeJobResult[] nodeJobResultList = new NodeJobResult[nodeSize]; ResultFuture[] resultList = new ResultFuture[nodeSize]; for (int i = 0; i < nodeList.size(); i++) { Node node = nodeList.get(i); TransferIndexFileJob transferJob = new TransferIndexFileJob(file, node); resultList[i] = JobService.getInstance().offer(transferJob); } for (int i = 0; i < nodeList.size(); i++) { boolean isSuccess = false; if (resultList[i] != null) { Object obj = resultList[i].take(); isSuccess = resultList[i].isSuccess() && obj instanceof Boolean && (Boolean) obj; } nodeJobResultList[i] = new NodeJobResult(nodeList.get(i), null, isSuccess); } return new JobResult(nodeJobResultList); }