HStoreSiteTestUtil.LatchableProcedureCallback blockedCallback = new HStoreSiteTestUtil.LatchableProcedureCallback(1);
DtxnTester.NOTIFY_BEFORE.drainPermits();
DtxnTester.LOCK_BEFORE.drainPermits();
DtxnTester.NOTIFY_AFTER.drainPermits();
DtxnTester.LOCK_AFTER.drainPermits();
Procedure catalog_proc = this.getProcedure(DtxnTester.class);
Object params[] = new Object[]{ BASE_PARTITION };
this.client.callProcedure(blockedCallback, catalog_proc.getName(), params);
// Block until we know that the txn has started running
boolean result = DtxnTester.NOTIFY_BEFORE.tryAcquire(NOTIFY_TIMEOUT, TimeUnit.MILLISECONDS);
assertTrue(result);
// Fire off a mix of single-partition txns and distributed txns
// Since we will delay each invocation, we know that the txn ids
// will be farther enough apart that we should expect them to be
// returned in the proper order
Procedure spProc = this.getProcedure(GetSubscriberData.class);
HStoreSiteTestUtil.LatchableProcedureCallback spCallback = new HStoreSiteTestUtil.LatchableProcedureCallback(NUM_TXNS);
// spCallback.setDebug(true);
Procedure mpProc = this.getProcedure(DeleteCallForwarding.class);
HStoreSiteTestUtil.LatchableProcedureCallback mpCallback = new HStoreSiteTestUtil.LatchableProcedureCallback(NUM_TXNS);
// mpCallback.setDebug(true);
for (int i = 0; i < NUM_TXNS; i++) {
// SINGLE-PARTITION
params = new Object[]{ new Long(i) };
this.client.callProcedure(spCallback, spProc.getName(), params);
ThreadUtil.sleep(100);
// MULTI-PARTITION
params = new Object[]{ Integer.toString(i), 1l, 1l };
this.client.callProcedure(mpCallback, mpProc.getName(), params);
ThreadUtil.sleep(100);
} // FOR
// Sleep for a bit. We still should have gotten back any responses
ThreadUtil.sleep(NOTIFY_TIMEOUT);