1 28 29 30 package com.caucho.tools.profiler; 31 32 import javax.transaction.xa.XAException ; 33 import javax.transaction.xa.XAResource ; 34 import javax.transaction.xa.Xid ; 35 36 public class XAResourceWrapper 37 implements XAResource 38 { 39 private final ProfilerPoint _profilerPoint; 40 private final XAResource _xaResource; 41 42 public XAResourceWrapper(ProfilerPoint profilerPoint, XAResource xaResource) 43 { 44 _profilerPoint = profilerPoint; 45 _xaResource = xaResource; 46 } 47 48 public void commit(Xid xid, boolean b) 49 throws XAException 50 { 51 Profiler profiler = _profilerPoint.start(); 52 53 try { 54 _xaResource.commit(xid, b); 55 } 56 finally { 57 profiler.finish(); 58 } 59 } 60 61 public void end(Xid xid, int i) 62 throws XAException 63 { 64 Profiler profiler = _profilerPoint.start(); 65 66 try { 67 _xaResource.end(xid, i); 68 } 69 finally { 70 profiler.finish(); 71 } 72 } 73 74 public void forget(Xid xid) 75 throws XAException 76 { 77 Profiler profiler = _profilerPoint.start(); 78 79 try { 80 _xaResource.forget(xid); 81 } 82 finally { 83 profiler.finish(); 84 } 85 } 86 87 public int getTransactionTimeout() 88 throws XAException 89 { 90 Profiler profiler = _profilerPoint.start(); 91 92 try { 93 return _xaResource.getTransactionTimeout(); 94 } 95 finally { 96 profiler.finish(); 97 } 98 } 99 100 public boolean isSameRM(XAResource xaResource) 101 throws XAException 102 { 103 Profiler profiler = _profilerPoint.start(); 104 105 try { 106 return _xaResource.isSameRM(xaResource); 107 } 108 finally { 109 profiler.finish(); 110 } 111 } 112 113 public int prepare(Xid xid) 114 throws XAException 115 { 116 Profiler profiler = _profilerPoint.start(); 117 118 try { 119 return _xaResource.prepare(xid); 120 } 121 finally { 122 profiler.finish(); 123 } 124 } 125 126 public Xid [] recover(int i) 127 throws XAException 128 { 129 Profiler profiler = _profilerPoint.start(); 130 131 try { 132 return _xaResource.recover(i); 133 } 134 finally { 135 profiler.finish(); 136 } 137 } 138 139 public void rollback(Xid xid) 140 throws XAException 141 { 142 Profiler profiler = _profilerPoint.start(); 143 144 try { 145 _xaResource.rollback(xid); 146 } 147 finally { 148 profiler.finish(); 149 } 150 } 151 152 public boolean setTransactionTimeout(int i) 153 throws XAException 154 { 155 Profiler profiler = _profilerPoint.start(); 156 157 try { 158 return _xaResource.setTransactionTimeout(i); 159 } 160 finally { 161 profiler.finish(); 162 } 163 } 164 165 public void start(Xid xid, int i) 166 throws XAException 167 { 168 Profiler profiler = _profilerPoint.start(); 169 170 try { 171 _xaResource.start(xid, i); 172 } 173 finally { 174 profiler.finish(); 175 } 176 } 177 178 public String toString() 179 { 180 return "XAResourceWrapper[" + _profilerPoint.getName() + "]"; 181 } 182 } 183 | Popular Tags |