HBASE-9318: Procedure#waitForLatch may not throw error even there is one

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1517095 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jeffreyz 2013-08-24 01:09:43 +00:00
parent d77b723d71
commit 1e93708268
2 changed files with 7 additions and 2 deletions

View File

@ -375,5 +375,9 @@ public class Procedure implements Callable<Void>, ForeignExceptionListener {
+ wakeFrequency + " ms)"); */
released = latch.await(wakeFrequency, TimeUnit.MILLISECONDS);
}
// check error again in case an error raised during last wait
if (monitor != null) {
monitor.rethrowException();
}
}
}

View File

@ -39,6 +39,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.hadoop.hbase.SmallTests;
import org.apache.hadoop.hbase.errorhandling.ForeignException;
@ -136,7 +137,7 @@ public class TestProcedureCoordinator {
// run the operation
proc = coordinator.startProcedure(proc.getErrorMonitor(), procName, procData, expected);
// and wait for it to finish
proc.waitForCompleted();
while(!proc.completedLatch.await(WAKE_FREQUENCY, TimeUnit.MILLISECONDS));
verify(procSpy, atLeastOnce()).receive(any(ForeignException.class));
verify(coordinator, times(1)).rpcConnectionFailure(anyString(), eq(cause));
verify(controller, times(1)).sendGlobalBarrierAcquire(procSpy, procData, expected);
@ -168,7 +169,7 @@ public class TestProcedureCoordinator {
// run the operation
Procedure task = coordinator.startProcedure(spy.getErrorMonitor(), procName, procData, expected);
// and wait for it to finish
task.waitForCompleted();
while(!task.completedLatch.await(WAKE_FREQUENCY, TimeUnit.MILLISECONDS));
verify(spy, atLeastOnce()).receive(any(ForeignException.class));
verify(coordinator, times(1)).rpcConnectionFailure(anyString(), eq(cause));
verify(controller, times(1)).sendGlobalBarrierAcquire(eq(spy),