Package org.apache.drill.exec.testing
Interface CountDownLatchInjection
- All Superinterfaces:
AutoCloseable
,AutoCloseables.Closeable
- All Known Implementing Classes:
CountDownLatchInjectionImpl
This class is used internally for tracking injected countdown latches. These latches are specified via
ExecConstants.DRILLBIT_CONTROL_INJECTIONS
session option.
This injection is useful in the case where a thread spawns multiple threads. The parent thread initializes the latch
with the expected number of countdown and awaits. The child threads count down on the same latch (same site class
and same descriptor), and once there are enough, the parent thread continues.-
Method Summary
Modifier and TypeMethodDescriptionvoid
await()
Causes the current thread to wait until the latch has counted down to zero, unless the thread isinterrupted
.void
Await without interruption.void
close()
Close the latch.void
Decrements the count of the latch, releasing all waiting threads if the count reaches zero.void
initialize
(int count) Initializes the underlying latch
-
Method Details
-
initialize
void initialize(int count) Initializes the underlying latch- Parameters:
count
- the number of timescountDown()
must be invoke before threads can pass throughawait()
-
await
Causes the current thread to wait until the latch has counted down to zero, unless the thread isinterrupted
.- Throws:
InterruptedException
-
awaitUninterruptibly
void awaitUninterruptibly()Await without interruption. In the case of interruption, log a warning and continue to wait. -
countDown
void countDown()Decrements the count of the latch, releasing all waiting threads if the count reaches zero. -
close
void close()Close the latch.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceAutoCloseables.Closeable
-