| 14 | public class CatAspect { |
| 15 | |
| 16 | @Around("@annotation(catTransaction)") |
| 17 | public Object catTransactionProcess(ProceedingJoinPoint pjp, CatTransaction catTransaction) throws Throwable { |
| 18 | String transName = pjp.getSignature().getDeclaringType().getSimpleName() + "." + pjp.getSignature().getName(); |
| 19 | if(StringUtils.isNotBlank(catTransaction.name())){ |
| 20 | transName = catTransaction.name(); |
| 21 | } |
| 22 | Transaction t = Cat.newTransaction(catTransaction.type(), transName); |
| 23 | try { |
| 24 | Object result = pjp.proceed(); |
| 25 | t.setStatus(Transaction.SUCCESS); |
| 26 | return result; |
| 27 | } catch (Throwable e) { |
| 28 | t.setStatus(e); |
| 29 | throw e; |
| 30 | }finally{ |
| 31 | t.complete(); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | @Around("@annotation(catCacheTransaction)") |
| 36 | public Object catCacheTransactionProcess(ProceedingJoinPoint pjp, CatCacheTransaction catCacheTransaction) throws Throwable { |