Package org.apache.drill.exec.testing
Class CountDownLatchInjectionImpl
java.lang.Object
org.apache.drill.exec.testing.Injection
org.apache.drill.exec.testing.CountDownLatchInjectionImpl
- All Implemented Interfaces:
AutoCloseable,AutoCloseables.Closeable,CountDownLatchInjection
See
CountDownLatchInjection Degenerates to
PauseInjection.pause(), if initialized to zero count. In any case, this injection
provides more control than PauseInjection.-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoidawait()Causes the current thread to wait until the latch has counted down to zero, unless the thread isinterrupted.voidAwait without interruption.voidclose()Close the latch.voidDecrements the count of the latch, releasing all waiting threads if the count reaches zero.voidinitialize(int count) Initializes the underlying latchprotected booleanThis function checks if it is the right time for the injection to happen.Methods inherited from class org.apache.drill.exec.testing.Injection
getDesc, getMsPause, getSiteClass, isValidForBit, toString
-
Method Details
-
injectNow
protected boolean injectNow()Description copied from class:InjectionThis function checks if it is the right time for the injection to happen. -
initialize
public void initialize(int count) Description copied from interface:CountDownLatchInjectionInitializes the underlying latch- Specified by:
initializein interfaceCountDownLatchInjection- Parameters:
count- the number of timesCountDownLatchInjection.countDown()must be invoke before threads can pass throughCountDownLatchInjection.await()
-
await
Description copied from interface:CountDownLatchInjectionCauses the current thread to wait until the latch has counted down to zero, unless the thread isinterrupted.- Specified by:
awaitin interfaceCountDownLatchInjection- Throws:
InterruptedException
-
awaitUninterruptibly
public void awaitUninterruptibly()Description copied from interface:CountDownLatchInjectionAwait without interruption. In the case of interruption, log a warning and continue to wait.- Specified by:
awaitUninterruptiblyin interfaceCountDownLatchInjection
-
countDown
public void countDown()Description copied from interface:CountDownLatchInjectionDecrements the count of the latch, releasing all waiting threads if the count reaches zero.- Specified by:
countDownin interfaceCountDownLatchInjection
-
close
public void close()Description copied from interface:CountDownLatchInjectionClose the latch.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceAutoCloseables.Closeable- Specified by:
closein interfaceCountDownLatchInjection
-