HBASE-11445 TestZKProcedure#testMultiCohortWithMemberTimeoutDuringPrepare is flaky (Jeffrey Zhong)

This commit is contained in:
Enis Soztutar 2014-09-08 20:57:55 -07:00
parent c70da8b278
commit f509f61a40
1 changed files with 2 additions and 4 deletions

View File

@ -266,17 +266,15 @@ public class TestZKProcedure {
} }
// pass out a task per member // pass out a task per member
final int[] i = new int[] { 0 }; final AtomicInteger taskIndex = new AtomicInteger();
Mockito.when( Mockito.when(
subprocFactory.buildSubprocedure(Mockito.eq(opName), subprocFactory.buildSubprocedure(Mockito.eq(opName),
(byte[]) Mockito.argThat(new ArrayEquals(data)))).thenAnswer( (byte[]) Mockito.argThat(new ArrayEquals(data)))).thenAnswer(
new Answer<Subprocedure>() { new Answer<Subprocedure>() {
@Override @Override
public Subprocedure answer(InvocationOnMock invocation) throws Throwable { public Subprocedure answer(InvocationOnMock invocation) throws Throwable {
int index = i[0]; int index = taskIndex.getAndIncrement();
Subprocedure commit = cohortTasks.get(index); Subprocedure commit = cohortTasks.get(index);
index++;
i[0] = index;
return commit; return commit;
} }
}); });