use of com.ctrip.xpipe.redis.console.exception.ServerException in project x-pipe by ctripcorp.
the class DalTransactionAspect method invokeDalTransactionMethod.
@Around("dalTransaction()")
public Object invokeDalTransactionMethod(ProceedingJoinPoint joinPoint) {
String datasource = config.getDatasource();
if (null == datasource) {
throw new ServerException("Cannot fetch datasource.");
}
logger.info("[invokeDalTransactionMethod] TransactionManager: {}", transactionManager.getClass());
transactionManager.startTransaction(datasource);
Object result;
try {
result = joinPoint.proceed();
transactionManager.commitTransaction();
return result;
} catch (Throwable e) {
transactionManager.rollbackTransaction();
throw new ServerException(e.getMessage(), e);
}
}
use of com.ctrip.xpipe.redis.console.exception.ServerException in project x-pipe by ctripcorp.
the class DalTransactionAspect method postConstruct.
@PostConstruct
private void postConstruct() {
try {
transactionManager = ContainerLoader.getDefaultContainer().lookup(TransactionManager.class, ROLE_HINT);
logger.info("[postConstruct]Load TransactionManager: {}", transactionManager.getClass());
} catch (ComponentLookupException e) {
throw new ServerException("Cannot find transaction manager.", e);
}
}
use of com.ctrip.xpipe.redis.console.exception.ServerException in project x-pipe by ctripcorp.
the class ShardDao method postConstruct.
@PostConstruct
private void postConstruct() {
try {
clusterTblDao = ContainerLoader.getDefaultContainer().lookup(ClusterTblDao.class);
dcClusterTblDao = ContainerLoader.getDefaultContainer().lookup(DcClusterTblDao.class);
shardTblDao = ContainerLoader.getDefaultContainer().lookup(ShardTblDao.class);
dcClusterShardTblDao = ContainerLoader.getDefaultContainer().lookup(DcClusterShardTblDao.class);
} catch (ComponentLookupException e) {
throw new ServerException("Cannot construct dao.", e);
}
}
Aggregations