synchronized (TPCCSimulation.class) {
if (remoteWarehouseIds == null) {
remoteWarehouseIds = new HashMap<Integer, List<Integer>>();
HashMap <Integer, Integer> partitionToSite = new HashMap<Integer, Integer>();
DefaultHasher hasher = new DefaultHasher(catalogContext);
for (Site s: catalogContext.sites) {
for (Partition p: s.getPartitions())
partitionToSite.put(p.getId(), s.getId());
} // FOR
for (int w_id0 = parameters.starting_warehouse; w_id0 <= parameters.last_warehouse; w_id0++) {
final int partition0 = hasher.hash(w_id0);
final int site0 = partitionToSite.get(partition0);
final List<Integer> rList = new ArrayList<Integer>();
for (int w_id1 = parameters.starting_warehouse; w_id1 <= parameters.last_warehouse; w_id1++) {
// Figure out what partition this W_ID maps to
int partition1 = hasher.hash(w_id1);
// Check whether this partition is on our same local site
int site1 = partitionToSite.get(partition1);
if (site0 != site1) rList.add(w_id1);
} // FOR