use of com.ctrip.xpipe.redis.console.annotation.DalTransaction in project x-pipe by ctripcorp.
the class ShardDao method deleteShardsBatch.
@DalTransaction
public void deleteShardsBatch(final ShardTbl shard) throws DalException {
if (null == shard)
throw new DalException("Null cannot be deleted.");
List<DcClusterShardTbl> relatedDcClusterShards = queryHandler.handleQuery(new DalQuery<List<DcClusterShardTbl>>() {
@Override
public List<DcClusterShardTbl> doQuery() throws DalException {
return dcClusterShardTblDao.findAllByShardId(shard.getId(), DcClusterShardTblEntity.READSET_FULL);
}
});
if (null != relatedDcClusterShards) {
dcClusterShardDao.deleteDcClusterShardsBatch(relatedDcClusterShards);
}
ShardTbl proto = shard;
proto.setShardName(generateDeletedName(shard.getShardName()));
queryHandler.handleDelete(new DalQuery<Integer>() {
@Override
public Integer doQuery() throws DalException {
return shardTblDao.deleteShard(proto, ShardTblEntity.UPDATESET_FULL);
}
}, true);
}
Aggregations