1 7 package org.jboss.cache.transaction; 8 9 import org.jboss.cache.TransactionManagerLookup; 10 11 import javax.transaction.NotSupportedException ; 12 import javax.transaction.RollbackException ; 13 import javax.transaction.SystemException ; 14 import javax.transaction.Transaction ; 15 import javax.transaction.TransactionManager ; 16 17 22 public class NotifyingTransactionManager extends DummyTransactionManager implements TransactionManagerLookup 23 { 24 public NotifyingTransactionManager() 25 { 26 super(); 27 } 28 29 Notification notification; 30 31 public void begin() throws SystemException , NotSupportedException 32 { 33 super.begin(); 34 try 35 { 36 System.out.println("Calling notification.notify()"); 37 notification.notify(getTransaction()); 38 } 39 catch (RollbackException e) 40 { 41 e.printStackTrace(); 42 } 43 } 44 45 public TransactionManager getTransactionManager() throws Exception 46 { 47 return this; 48 } 49 50 public interface Notification 51 { 52 public void notify(Transaction tx) throws SystemException , RollbackException ; 53 } 54 55 } 56 57 58 59 | Popular Tags |