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:
parent
d77b723d71
commit
1e93708268
|
@ -375,5 +375,9 @@ public class Procedure implements Callable<Void>, ForeignExceptionListener {
|
||||||
+ wakeFrequency + " ms)"); */
|
+ wakeFrequency + " ms)"); */
|
||||||
released = latch.await(wakeFrequency, TimeUnit.MILLISECONDS);
|
released = latch.await(wakeFrequency, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
// check error again in case an error raised during last wait
|
||||||
|
if (monitor != null) {
|
||||||
|
monitor.rethrowException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.SmallTests;
|
import org.apache.hadoop.hbase.SmallTests;
|
||||||
import org.apache.hadoop.hbase.errorhandling.ForeignException;
|
import org.apache.hadoop.hbase.errorhandling.ForeignException;
|
||||||
|
@ -136,7 +137,7 @@ public class TestProcedureCoordinator {
|
||||||
// run the operation
|
// run the operation
|
||||||
proc = coordinator.startProcedure(proc.getErrorMonitor(), procName, procData, expected);
|
proc = coordinator.startProcedure(proc.getErrorMonitor(), procName, procData, expected);
|
||||||
// and wait for it to finish
|
// and wait for it to finish
|
||||||
proc.waitForCompleted();
|
while(!proc.completedLatch.await(WAKE_FREQUENCY, TimeUnit.MILLISECONDS));
|
||||||
verify(procSpy, atLeastOnce()).receive(any(ForeignException.class));
|
verify(procSpy, atLeastOnce()).receive(any(ForeignException.class));
|
||||||
verify(coordinator, times(1)).rpcConnectionFailure(anyString(), eq(cause));
|
verify(coordinator, times(1)).rpcConnectionFailure(anyString(), eq(cause));
|
||||||
verify(controller, times(1)).sendGlobalBarrierAcquire(procSpy, procData, expected);
|
verify(controller, times(1)).sendGlobalBarrierAcquire(procSpy, procData, expected);
|
||||||
|
@ -168,7 +169,7 @@ public class TestProcedureCoordinator {
|
||||||
// run the operation
|
// run the operation
|
||||||
Procedure task = coordinator.startProcedure(spy.getErrorMonitor(), procName, procData, expected);
|
Procedure task = coordinator.startProcedure(spy.getErrorMonitor(), procName, procData, expected);
|
||||||
// and wait for it to finish
|
// and wait for it to finish
|
||||||
task.waitForCompleted();
|
while(!task.completedLatch.await(WAKE_FREQUENCY, TimeUnit.MILLISECONDS));
|
||||||
verify(spy, atLeastOnce()).receive(any(ForeignException.class));
|
verify(spy, atLeastOnce()).receive(any(ForeignException.class));
|
||||||
verify(coordinator, times(1)).rpcConnectionFailure(anyString(), eq(cause));
|
verify(coordinator, times(1)).rpcConnectionFailure(anyString(), eq(cause));
|
||||||
verify(controller, times(1)).sendGlobalBarrierAcquire(eq(spy),
|
verify(controller, times(1)).sendGlobalBarrierAcquire(eq(spy),
|
||||||
|
|
Loading…
Reference in New Issue