use of com.vip.saturn.job.console.domain.RequestResult in project Saturn by vipshop.
the class NamespaceZkClusterMappingController method getMoveNamespaceBatchStatus.
@RequestMapping(value = "getMoveNamespaceBatchStatus", method = RequestMethod.GET)
public RequestResult getMoveNamespaceBatchStatus(HttpServletRequest request) {
RequestResult requestResult = new RequestResult();
try {
Thread.sleep(400L);
MoveNamespaceBatchStatus moveNamespaceBatchStatus = namespaceZkClusterMappingService.getMoveNamespaceBatchStatus();
if (moveNamespaceBatchStatus == null) {
throw new SaturnJobConsoleException("The MoveNamespaceBatchStatus is not existing in db");
}
requestResult.setSuccess(true);
requestResult.setObj(moveNamespaceBatchStatus);
} catch (Throwable t) {
LOGGER.error(t.getMessage(), t);
requestResult.setSuccess(false);
requestResult.setMessage(t.toString());
}
return requestResult;
}
use of com.vip.saturn.job.console.domain.RequestResult in project Saturn by vipshop.
the class NamespaceZkClusterMappingController method getZkClusterListWithOnline.
@RequestMapping(value = "getZkClusterListWithOnline", method = RequestMethod.GET)
public RequestResult getZkClusterListWithOnline(HttpServletRequest request) {
RequestResult requestResult = new RequestResult();
try {
List<String> zkClusterListWithOnlineFromCfg = namespaceZkClusterMappingService.getZkClusterListWithOnline();
requestResult.setObj(zkClusterListWithOnlineFromCfg);
requestResult.setSuccess(true);
} catch (SaturnJobConsoleException e) {
requestResult.setSuccess(false);
requestResult.setMessage(e.getMessage());
} catch (Throwable t) {
LOGGER.error(t.getMessage(), t);
requestResult.setSuccess(false);
requestResult.setMessage(t.toString());
}
return requestResult;
}
use of com.vip.saturn.job.console.domain.RequestResult in project Saturn by vipshop.
the class NamespaceZkClusterMappingController method getNamespaceZkclusterMappingList.
@RequestMapping(value = "getNamespaceZkclusterMappingList", method = RequestMethod.GET)
public RequestResult getNamespaceZkclusterMappingList(HttpServletRequest request) {
RequestResult requestResult = new RequestResult();
try {
List<NamespaceZkClusterMappingVo> namespaceZkclusterMappingList = namespaceZkClusterMappingService.getNamespaceZkClusterMappingList();
requestResult.setObj(namespaceZkclusterMappingList);
requestResult.setSuccess(true);
} catch (SaturnJobConsoleException e) {
requestResult.setSuccess(false);
requestResult.setMessage(e.getMessage());
} catch (Throwable t) {
LOGGER.error(t.getMessage(), t);
requestResult.setSuccess(false);
requestResult.setMessage(t.toString());
}
return requestResult;
}
use of com.vip.saturn.job.console.domain.RequestResult in project Saturn by vipshop.
the class SaturnJunkDataController method deleteRunningNode.
@ResponseBody
@RequestMapping(value = "junkData/deleteRunningNode", method = RequestMethod.POST)
public RequestResult deleteRunningNode(String namespace, String jobName, Integer item) {
RequestResult requestResult = new RequestResult();
try {
if (namespace == null || namespace.trim().isEmpty()) {
throw new SaturnJobConsoleException("The namespace can not be null or empty");
}
if (jobName == null || jobName.trim().isEmpty()) {
throw new SaturnJobConsoleException("The jobName can not be null or empty");
}
if (item == null) {
throw new SaturnJobConsoleException("The item can not be null");
}
saturnJunkDataService.deleteRunningNode(namespace, jobName, item);
LOGGER.info("do junkData/deleteRunningNode success, namespace is {}, jobName is {}, item is {}", namespace, jobName, item);
requestResult.setSuccess(true);
} catch (Throwable t) {
requestResult.setSuccess(false);
if (t instanceof SaturnJobConsoleException) {
requestResult.setMessage(t.getMessage());
} else {
requestResult.setMessage(t.toString());
}
LOGGER.error(t.getMessage(), t);
}
return requestResult;
}
use of com.vip.saturn.job.console.domain.RequestResult in project Saturn by vipshop.
the class ZKDBDiffController method diffByCluster.
/**
* 按照zk集群,对比zk和db的数据差异。<br> 如果console和zk集群不是在同一机房,则会将调用zk所属机房的console rest api去进行对比,如果对比失败,则继续在本机房进行对比;
*
* @param request
* @param zkCluster
* @return
*/
@RequestMapping(value = "zk_db_diff/diffByCluster", method = RequestMethod.GET)
@ResponseBody
public RequestResult diffByCluster(HttpServletRequest request, String zkCluster) {
RequestResult requestResult = new RequestResult();
List<JobDiffInfo> resultList = null;
try {
if (!ZkClusterMappingUtils.isCurrentConsoleInTheSameIdc(systemConfigService, zkCluster)) {
resultList = relayDiffIfPossible(zkCluster);
} else {
resultList = zkDBDiffService.diffByCluster(zkCluster);
}
requestResult.setSuccess(true);
requestResult.setObj(resultList);
} catch (Exception e) {
requestResult.setSuccess(false);
requestResult.setMessage(e.toString());
}
return requestResult;
}
Aggregations