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 class
RMXAConnectionResource.XidKey
This 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:
getXAResource
in interfaceXAConnection
- Throws:
SQLException
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnection
in interfacePooledConnection
- Throws:
SQLException
-
close
public void close() throws SQLException
- Specified by:
close
in interfacePooledConnection
- Throws:
SQLException
-
addConnectionEventListener
public void addConnectionEventListener(ConnectionEventListener listener)
- Specified by:
addConnectionEventListener
in interfacePooledConnection
-
removeConnectionEventListener
public void removeConnectionEventListener(ConnectionEventListener listener)
- Specified by:
removeConnectionEventListener
in interfacePooledConnection
-
addStatementEventListener
public void addStatementEventListener(StatementEventListener listener)
- Specified by:
addStatementEventListener
in interfacePooledConnection
-
removeStatementEventListener
public void removeStatementEventListener(StatementEventListener listener)
- Specified by:
removeStatementEventListener
in interfacePooledConnection
-
recover
public Xid[] recover(int flag) throws XAException
- Specified by:
recover
in interfaceXAResource
- Throws:
XAException
-
commit
public void commit(Xid xid, boolean onePhase) throws XAException
- Specified by:
commit
in interfaceXAResource
- Throws:
XAException
-
end
public void end(Xid xid, int flag) throws XAException
- Specified by:
end
in interfaceXAResource
- Throws:
XAException
-
forget
public void forget(Xid xid) throws XAException
- Specified by:
forget
in interfaceXAResource
- Throws:
XAException
-
getTransactionTimeout
public int getTransactionTimeout() throws XAException
- Specified by:
getTransactionTimeout
in interfaceXAResource
- Throws:
XAException
-
isSameRM
public boolean isSameRM(XAResource otherResource) throws XAException
- Specified by:
isSameRM
in interfaceXAResource
- Throws:
XAException
-
prepare
public int prepare(Xid xid) throws XAException
- Specified by:
prepare
in interfaceXAResource
- Throws:
XAException
-
rollback
public void rollback(Xid xid) throws XAException
- Specified by:
rollback
in interfaceXAResource
- Throws:
XAException
-
setTransactionTimeout
public boolean setTransactionTimeout(int timeoutSecs) throws XAException
- Specified by:
setTransactionTimeout
in interfaceXAResource
- Throws:
XAException
-
start
public void start(Xid xid, int flag) throws XAException
- Specified by:
start
in 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
-
-