Search in sources :

Example 1 with ClusterEvent

use of com.ctrip.xpipe.redis.console.notifier.cluster.ClusterEvent in project x-pipe by ctripcorp.

the class ClusterServiceImpl method deleteCluster.

@Override
public void deleteCluster(String clusterName) {
    ClusterTbl proto = find(clusterName);
    if (null == proto)
        throw new BadRequestException("Cannot find cluster");
    proto.setClusterLastModifiedTime(DataModifiedTimeGenerator.generateModifiedTime());
    List<DcTbl> relatedDcs = dcService.findClusterRelatedDc(clusterName);
    final ClusterTbl queryProto = proto;
    // Call cluster delete event
    ClusterEvent clusterEvent = clusterDeleteEventFactory.createClusterEvent(clusterName);
    try {
        clusterDao.deleteCluster(queryProto);
    } catch (Exception e) {
        throw new ServerException(e.getMessage());
    }
    clusterEvent.onEvent();
    /**
     * Notify meta server *
     */
    notifier.notifyClusterDelete(clusterName, relatedDcs);
}
Also used : ClusterEvent(com.ctrip.xpipe.redis.console.notifier.cluster.ClusterEvent) ServerException(com.ctrip.xpipe.redis.console.exception.ServerException) BadRequestException(com.ctrip.xpipe.redis.console.exception.BadRequestException) ServerException(com.ctrip.xpipe.redis.console.exception.ServerException) XpipeRuntimeException(com.ctrip.xpipe.exception.XpipeRuntimeException) BadRequestException(com.ctrip.xpipe.redis.console.exception.BadRequestException) DalException(org.unidal.dal.jdbc.DalException)

Aggregations

XpipeRuntimeException (com.ctrip.xpipe.exception.XpipeRuntimeException)1 BadRequestException (com.ctrip.xpipe.redis.console.exception.BadRequestException)1 ServerException (com.ctrip.xpipe.redis.console.exception.ServerException)1 ClusterEvent (com.ctrip.xpipe.redis.console.notifier.cluster.ClusterEvent)1 DalException (org.unidal.dal.jdbc.DalException)1