1 4 package com.tcspring; 5 6 import com.tc.aspectwerkz.joinpoint.StaticJoinPoint; 7 import com.tc.object.bytecode.Manager; 8 import com.tc.object.bytecode.ManagerUtil; 9 10 19 public class TransactionManagerProtocol { 20 private static final String LOCK_NAME = "tc:spring-tx-lock"; 21 22 25 public Object startTransaction(final StaticJoinPoint jp, final Object manager) throws Throwable { 26 try { 27 return jp.proceed(); 28 } finally { 29 ManagerUtil.beginLock(LOCK_NAME, Manager.LOCK_TYPE_WRITE); 30 } 31 } 32 33 public Object commitTransaction(final StaticJoinPoint jp, final Object manager) throws Throwable { 34 try { 35 return jp.proceed(); 36 } finally { 37 ManagerUtil.commitLock(LOCK_NAME); 38 } 39 } 40 41 public Object rollbackTransaction(final StaticJoinPoint jp, final Object manager) throws Throwable { 42 try { 43 return jp.proceed(); 44 } finally { 45 ManagerUtil.commitLock(LOCK_NAME); 47 } 48 } 49 50 } 51 | Popular Tags |