1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.transport.jms.xa; |
8 | |
|
9 | |
import javax.transaction.xa.XAException; |
10 | |
import javax.transaction.xa.XAResource; |
11 | |
import javax.transaction.xa.Xid; |
12 | |
|
13 | |
public class XAResourceWrapper implements XAResource |
14 | |
{ |
15 | |
private XAResource xaResource; |
16 | |
private SessionInvocationHandler sessionInvocationHandler; |
17 | |
private Boolean sameRMOverrideValue; |
18 | |
|
19 | |
|
20 | |
public XAResourceWrapper(XAResource xaResource, SessionInvocationHandler sessionInvocationHandler, Boolean sameRMOverrideValue) |
21 | 0 | { |
22 | 0 | this.xaResource = xaResource; |
23 | 0 | this.sessionInvocationHandler = sessionInvocationHandler; |
24 | 0 | this.sameRMOverrideValue = sameRMOverrideValue; |
25 | 0 | } |
26 | |
|
27 | |
public int getTransactionTimeout() throws XAException |
28 | |
{ |
29 | 0 | return xaResource.getTransactionTimeout(); |
30 | |
} |
31 | |
|
32 | |
public boolean setTransactionTimeout(int i) throws XAException |
33 | |
{ |
34 | 0 | return xaResource.setTransactionTimeout(i); |
35 | |
} |
36 | |
|
37 | |
public boolean isSameRM(XAResource other) throws XAException |
38 | |
{ |
39 | 0 | if (sameRMOverrideValue != null) |
40 | |
{ |
41 | 0 | return sameRMOverrideValue; |
42 | |
} |
43 | |
|
44 | 0 | if (other instanceof XAResourceWrapper) |
45 | |
{ |
46 | 0 | other = ((XAResourceWrapper) other).xaResource; |
47 | |
} |
48 | 0 | return this.xaResource.isSameRM(other); |
49 | |
} |
50 | |
|
51 | |
public Xid[] recover(int i) throws XAException |
52 | |
{ |
53 | 0 | return xaResource.recover(i); |
54 | |
} |
55 | |
|
56 | |
public int prepare(Xid xid) throws XAException |
57 | |
{ |
58 | 0 | return xaResource.prepare(xid); |
59 | |
} |
60 | |
|
61 | |
public void forget(Xid xid) throws XAException |
62 | |
{ |
63 | 0 | xaResource.forget(xid); |
64 | 0 | } |
65 | |
|
66 | |
public void rollback(Xid xid) throws XAException |
67 | |
{ |
68 | 0 | xaResource.rollback(xid); |
69 | 0 | } |
70 | |
|
71 | |
public void end(Xid xid, int i) throws XAException |
72 | |
{ |
73 | 0 | xaResource.end(xid, i); |
74 | 0 | sessionInvocationHandler.setEnlisted(false); |
75 | 0 | } |
76 | |
|
77 | |
public void start(Xid xid, int i) throws XAException |
78 | |
{ |
79 | 0 | xaResource.start(xid, i); |
80 | 0 | } |
81 | |
|
82 | |
public void commit(Xid xid, boolean b) throws XAException |
83 | |
{ |
84 | 0 | xaResource.commit(xid, b); |
85 | 0 | } |
86 | |
|
87 | |
@Override |
88 | |
public String toString() |
89 | |
{ |
90 | 0 | return xaResource.toString(); |
91 | |
} |
92 | |
} |