1 28 29 package com.caucho.transaction.enhancer; 30 31 import com.caucho.java.JavaWriter; 32 import com.caucho.java.gen.CallChain; 33 import com.caucho.java.gen.FilterCallChain; 34 import com.caucho.util.L10N; 35 36 import java.io.IOException ; 37 38 41 public class RequiredCallChain extends FilterCallChain { 42 private static final L10N L = new L10N(RequiredCallChain.class); 43 44 public RequiredCallChain(CallChain next) 45 { 46 super(next); 47 } 48 49 50 58 public void generateCall(JavaWriter out, String retVar, 59 String var, String []args) 60 throws IOException 61 { 62 out.println("com.caucho.transaction.TransactionContainer _caucho_xa_c;"); 63 out.println("_caucho_xa_c = com.caucho.transaction.TransactionContainer.getTransactionContainer();"); 64 out.println("javax.transaction.Transaction _caucho_xa;"); 65 66 out.println("_caucho_xa = _caucho_xa_c.beginRequired();"); 67 68 out.println("try {"); 69 out.pushDepth(); 70 71 super.generateCall(out, retVar, var, args); 72 73 out.popDepth(); 74 out.println("} catch (RuntimeException e) {"); 75 out.println(" _caucho_xa_c.setRollbackOnly(e);"); 76 out.println(" throw e;"); 77 out.println("} finally {"); 78 out.println(" if (_caucho_xa == null)"); 79 out.println(" _caucho_xa_c.commit(null);"); 80 out.println("}"); 81 } 82 } 83 | Popular Tags |