/** * For some drivers, isSameRM is connection specific. If we have prev scan results * for the same RM but using a different connection, we need to be able to identify them. * Look at the data from previous scans, identify any for the same RM but different XAResource * by checking for matching Xids, then replace the old XAResource with the supplied one. * * @param xares * @param xids */ private void refreshXidScansForEquivalentXAResourceImpl(XAResource xares, Xid[] xids) { Set<XAResource> keys = new HashSet<XAResource>(_xidScans.keySet()); for(XAResource theKey : keys) { RecoveryXids recoveryXids = _xidScans.get(theKey); if(recoveryXids.updateIfEquivalentRM(xares, xids)) { // recoveryXids is for this xares, but was originally obtained using // a different XAResource. rekey the hashtable to use the new one. _xidScans.remove(theKey); _xidScans.put(xares, recoveryXids); } } }
/** * For some drivers, isSameRM is connection specific. If we have prev scan results * for the same RM but using a different connection, we need to be able to identify them. * Look at the data from previous scans, identify any for the same RM but different XAResource * by checking for matching Xids, then replace the old XAResource with the supplied one. * * @param xares * @param xids */ private void refreshXidScansForEquivalentXAResourceImpl(XAResource xares, Xid[] xids) { Set<XAResource> keys = new HashSet<XAResource>(_xidScans.keySet()); for(XAResource theKey : keys) { RecoveryXids recoveryXids = _xidScans.get(theKey); if(recoveryXids.updateIfEquivalentRM(xares, xids)) { // recoveryXids is for this xares, but was originally obtained using // a different XAResource. rekey the hashtable to use the new one. _xidScans.remove(theKey); _xidScans.put(xares, recoveryXids); _resources.remove(theKey); // There could be two datasources pointed at the same resource manager if (!_resources.contains(xares)) { _resources.add(xares); } } } }
/** * For some drivers, isSameRM is connection specific. If we have prev scan results * for the same RM but using a different connection, we need to be able to identify them. * Look at the data from previous scans, identify any for the same RM but different XAResource * by checking for matching Xids, then replace the old XAResource with the supplied one. * * @param xares * @param xids */ private void refreshXidScansForEquivalentXAResourceImpl(XAResource xares, Xid[] xids) { if(xids == null || xids.length == 0) { return; } Enumeration keys = _xidScans.keys(); while (keys.hasMoreElements()) { XAResource theKey = (XAResource) keys.nextElement(); RecoveryXids recoveryXids = (RecoveryXids) _xidScans.get(theKey); if(recoveryXids.updateIfEquivalentRM(xares, xids)) { // recoveryXids is for this xares, but was originally obtained using // a different XAResource. rekey the hashtable to use the new one. _xidScans.remove(theKey); theKey = xares; _xidScans.put(theKey, recoveryXids); break; } } }
/** * For some drivers, isSameRM is connection specific. If we have prev scan results * for the same RM but using a different connection, we need to be able to identify them. * Look at the data from previous scans, identify any for the same RM but different XAResource * by checking for matching Xids, then replace the old XAResource with the supplied one. * * @param xares * @param xids */ private void refreshXidScansForEquivalentXAResourceImpl(XAResource xares, Xid[] xids) { Set<XAResource> keys = new HashSet<XAResource>(_xidScans.keySet()); for(XAResource theKey : keys) { RecoveryXids recoveryXids = _xidScans.get(theKey); if(recoveryXids.updateIfEquivalentRM(xares, xids)) { // recoveryXids is for this xares, but was originally obtained using // a different XAResource. rekey the hashtable to use the new one. _xidScans.remove(theKey); _xidScans.put(xares, recoveryXids); _resources.remove(theKey); // There could be two datasources pointed at the same resource manager if (!_resources.contains(xares)) { _resources.add(xares); } } } }
/** * For some drivers, isSameRM is connection specific. If we have prev scan results * for the same RM but using a different connection, we need to be able to identify them. * Look at the data from previous scans, identify any for the same RM but different XAResource * by checking for matching Xids, then replace the old XAResource with the supplied one. * * @param xares * @param xids */ private void refreshXidScansForEquivalentXAResourceImpl(XAResource xares, Xid[] xids) { Set<XAResource> keys = new HashSet<XAResource>(_xidScans.keySet()); for(XAResource theKey : keys) { RecoveryXids recoveryXids = _xidScans.get(theKey); if(recoveryXids.updateIfEquivalentRM(xares, xids)) { // recoveryXids is for this xares, but was originally obtained using // a different XAResource. rekey the hashtable to use the new one. _xidScans.remove(theKey); _xidScans.put(xares, recoveryXids); _resources.remove(theKey); // There could be two datasources pointed at the same resource manager if (!_resources.contains(xares)) { _resources.add(xares); } } } }
/** * For some drivers, isSameRM is connection specific. If we have prev scan results * for the same RM but using a different connection, we need to be able to identify them. * Look at the data from previous scans, identify any for the same RM but different XAResource * by checking for matching Xids, then replace the old XAResource with the supplied one. * * @param xares * @param xids */ private void refreshXidScansForEquivalentXAResourceImpl(XAResource xares, Xid[] xids) { Set<XAResource> keys = new HashSet<XAResource>(_xidScans.keySet()); for(XAResource theKey : keys) { RecoveryXids recoveryXids = _xidScans.get(theKey); if(recoveryXids.updateIfEquivalentRM(xares, xids)) { // recoveryXids is for this xares, but was originally obtained using // a different XAResource. rekey the hashtable to use the new one. _xidScans.remove(theKey); _xidScans.put(xares, recoveryXids); _resources.remove(theKey); // There could be two datasources pointed at the same resource manager if (!_resources.contains(xares)) { _resources.add(xares); } } } }
/** * For some drivers, isSameRM is connection specific. If we have prev scan results * for the same RM but using a different connection, we need to be able to identify them. * Look at the data from previous scans, identify any for the same RM but different XAResource * by checking for matching Xids, then replace the old XAResource with the supplied one. * * @param xares * @param xids */ private void refreshXidScansForEquivalentXAResourceImpl(XAResource xares, Xid[] xids) { Set<XAResource> keys = new HashSet<XAResource>(_xidScans.keySet()); for(XAResource theKey : keys) { RecoveryXids recoveryXids = _xidScans.get(theKey); if(recoveryXids.updateIfEquivalentRM(xares, xids)) { // recoveryXids is for this xares, but was originally obtained using // a different XAResource. rekey the hashtable to use the new one. _xidScans.remove(theKey); _xidScans.put(xares, recoveryXids); _resources.remove(theKey); // There could be two datasources pointed at the same resource manager if (!_resources.contains(xares)) { _resources.add(xares); } } } }
assertFalse(rxids.updateIfEquivalentRM(new TestResource(), null)); assertTrue(rxids.updateIfEquivalentRM(new TestResource(), xids));