1 16 17 package org.springframework.transaction.jta; 18 19 import java.util.List ; 20 21 import javax.transaction.Status ; 22 import javax.transaction.Synchronization ; 23 24 import org.springframework.transaction.support.TransactionSynchronization; 25 import org.springframework.transaction.support.TransactionSynchronizationUtils; 26 27 35 public class JtaAfterCompletionSynchronization implements Synchronization { 36 37 private final List synchronizations; 38 39 40 45 public JtaAfterCompletionSynchronization(List synchronizations) { 46 this.synchronizations = synchronizations; 47 } 48 49 50 public void beforeCompletion() { 51 } 52 53 public void afterCompletion(int status) { 54 switch (status) { 55 case Status.STATUS_COMMITTED: 56 try { 57 TransactionSynchronizationUtils.invokeAfterCommit(this.synchronizations); 58 } 59 finally { 60 TransactionSynchronizationUtils.invokeAfterCompletion( 61 this.synchronizations, TransactionSynchronization.STATUS_COMMITTED); 62 } 63 break; 64 case Status.STATUS_ROLLEDBACK: 65 TransactionSynchronizationUtils.invokeAfterCompletion( 66 this.synchronizations, TransactionSynchronization.STATUS_ROLLED_BACK); 67 break; 68 default: 69 TransactionSynchronizationUtils.invokeAfterCompletion( 70 this.synchronizations, TransactionSynchronization.STATUS_UNKNOWN); 71 } 72 } 73 } 74 | Popular Tags |