Class RMXAConnectionResource
- java.lang.Object
-
- com.ibm.fhir.persistence.proxy.rm.RMXAConnectionResource
-
- All Implemented Interfaces:
PooledConnection,XAConnection,XAResource
public class RMXAConnectionResource extends Object implements XAConnection, XAResource
This class is used during XA recovery operations to represent an XAConnection and its associated XAResource, but in reality it serves as a proxy for ALL of the XAConnections and their associated XAResources related to XADataSources cached by the proxy datasource.
This class is only used during the XA Resource recovery operations triggered by the Liberty Recovery Manager.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRMXAConnectionResource.XidKeyThis inner class is used to represent an xid-based key suitable for use within a HashMap.
-
Field Summary
-
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
-
-
Constructor Summary
Constructors Constructor Description RMXAConnectionResource(FHIRProxyXADataSource parentDS)This ctor is invoked by the FHIRProxyXADataSource class when the Liberty Recovery Manager has triggered XA recovery operations.
-
Method Summary
-
-
-
Constructor Detail
-
RMXAConnectionResource
public RMXAConnectionResource(FHIRProxyXADataSource parentDS) throws SQLException
This ctor is invoked by the FHIRProxyXADataSource class when the Liberty Recovery Manager has triggered XA recovery operations.- Parameters:
parentDS- the parent FHIRProxyXADataSource instance- Throws:
SQLException
-
-
Method Detail
-
shouldBypassFailures
public static boolean shouldBypassFailures()
-
setBypassFailures
public static void setBypassFailures(Boolean flag)
-
getProxiedXADataSources
public Map<String,FHIRProxyXADataSource.DataSourceCacheEntry> getProxiedXADataSources()
-
setProxiedXADataSources
public void setProxiedXADataSources(Map<String,FHIRProxyXADataSource.DataSourceCacheEntry> proxiedXADataSources)
-
getProxiedXAConnections
public List<XAConnection> getProxiedXAConnections()
-
setProxiedXAConnections
public void setProxiedXAConnections(List<XAConnection> proxiedXAConnections)
-
getProxiedXAResources
public List<XAResource> getProxiedXAResources()
-
setProxiedXAResources
public void setProxiedXAResources(List<XAResource> proxiedXAResources)
-
getProxiedXids
public Map<RMXAConnectionResource.XidKey,List<XAResource>> getProxiedXids()
-
setProxiedXids
public void setProxiedXids(Map<RMXAConnectionResource.XidKey,List<XAResource>> proxiedXids)
-
getXAResource
public XAResource getXAResource() throws SQLException
- Specified by:
getXAResourcein interfaceXAConnection- Throws:
SQLException
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnectionin interfacePooledConnection- Throws:
SQLException
-
close
public void close() throws SQLException- Specified by:
closein interfacePooledConnection- Throws:
SQLException
-
addConnectionEventListener
public void addConnectionEventListener(ConnectionEventListener listener)
- Specified by:
addConnectionEventListenerin interfacePooledConnection
-
removeConnectionEventListener
public void removeConnectionEventListener(ConnectionEventListener listener)
- Specified by:
removeConnectionEventListenerin interfacePooledConnection
-
addStatementEventListener
public void addStatementEventListener(StatementEventListener listener)
- Specified by:
addStatementEventListenerin interfacePooledConnection
-
removeStatementEventListener
public void removeStatementEventListener(StatementEventListener listener)
- Specified by:
removeStatementEventListenerin interfacePooledConnection
-
recover
public Xid[] recover(int flag) throws XAException
- Specified by:
recoverin interfaceXAResource- Throws:
XAException
-
commit
public void commit(Xid xid, boolean onePhase) throws XAException
- Specified by:
commitin interfaceXAResource- Throws:
XAException
-
end
public void end(Xid xid, int flag) throws XAException
- Specified by:
endin interfaceXAResource- Throws:
XAException
-
forget
public void forget(Xid xid) throws XAException
- Specified by:
forgetin interfaceXAResource- Throws:
XAException
-
getTransactionTimeout
public int getTransactionTimeout() throws XAException- Specified by:
getTransactionTimeoutin interfaceXAResource- Throws:
XAException
-
isSameRM
public boolean isSameRM(XAResource otherResource) throws XAException
- Specified by:
isSameRMin interfaceXAResource- Throws:
XAException
-
prepare
public int prepare(Xid xid) throws XAException
- Specified by:
preparein interfaceXAResource- Throws:
XAException
-
rollback
public void rollback(Xid xid) throws XAException
- Specified by:
rollbackin interfaceXAResource- Throws:
XAException
-
setTransactionTimeout
public boolean setTransactionTimeout(int timeoutSecs) throws XAException- Specified by:
setTransactionTimeoutin interfaceXAResource- Throws:
XAException
-
start
public void start(Xid xid, int flag) throws XAException
- Specified by:
startin interfaceXAResource- Throws:
XAException
-
bytesToHex
public static String bytesToHex(byte[] bytes)
Converts the specified byte array into a string by converting each byte into a 2-digit hex string.- Parameters:
bytes- the byte array to be converted
-
-