public final class NoOpControlsInjector extends Object implements ControlsInjector
ControlsInjector
for documentation.Modifier and Type | Field and Description |
---|---|
static CountDownLatchInjection |
LATCH
When assertions are not enabled, this count down latch that does nothing is injected.
|
Modifier | Constructor and Description |
---|---|
protected |
NoOpControlsInjector(Class<?> clazz)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
CountDownLatchInjection |
getLatch(ExecutionControls executionControls,
String desc)
Used to insert a latch in site class.
|
Class<?> |
getSiteClass()
Get the injector's owning class.
|
<T extends Throwable> |
injectChecked(ExecutionControls executionControls,
String desc,
Class<T> exceptionClass)
Inject (throw) a checked exception at this point, if an injection is specified, and it is time
for it to be thrown.
|
void |
injectInterruptiblePause(ExecutionControls executionControls,
String desc,
org.slf4j.Logger logger)
Insert a pause that can be interrupted using
Thread.interrupt() at the given site point, if such an
injection is specified (i.e. |
void |
injectPause(ExecutionControls executionControls,
String desc,
org.slf4j.Logger logger)
Pauses at this point, if such an injection is specified (i.e.
|
void |
injectUnchecked(ExecutionControls executionControls,
String desc)
Inject (throw) an unchecked exception at this point, if an injection is specified, and it is time
for it to be thrown.
|
public static final CountDownLatchInjection LATCH
protected NoOpControlsInjector(Class<?> clazz)
ControlsInjectorFactory.getInjector(java.lang.Class<?>)
method to obtain their
injector.clazz
- the owning classpublic Class<?> getSiteClass()
ControlsInjector
getSiteClass
in interface ControlsInjector
public void injectUnchecked(ExecutionControls executionControls, String desc)
ControlsInjector
Implementors use this in their code at a site where they want to simulate an exception during testing.
injectUnchecked
in interface ControlsInjector
executionControls
- the controls in the current contextdesc
- the site descriptor
throws the exception specified by the injection, if it is timepublic <T extends Throwable> void injectChecked(ExecutionControls executionControls, String desc, Class<T> exceptionClass) throws T extends Throwable
ControlsInjector
Implementors use this in their code at a site where they want to simulate an exception during testing.
injectChecked
in interface ControlsInjector
executionControls
- the controls in the current contextdesc
- the site descriptorexceptionClass
- the expected class of the exception (or a super class of it)T
- the exception specified by the injection, if it is timeT extends Throwable
public void injectPause(ExecutionControls executionControls, String desc, org.slf4j.Logger logger)
ControlsInjector
Implementors use this in their code at a site where they want to simulate a pause during testing.
injectPause
in interface ControlsInjector
executionControls
- the controls in the current contextdesc
- the site descriptorlogger
- logger of the class containing the injection sitepublic void injectInterruptiblePause(ExecutionControls executionControls, String desc, org.slf4j.Logger logger) throws InterruptedException
ControlsInjector
Thread.interrupt()
at the given site point, if such an
injection is specified (i.e. matches the site description).
Implementors use this in their code at a site where they want to simulate a interruptible pause during testing.
injectInterruptiblePause
in interface ControlsInjector
executionControls
- the controls in the current contextdesc
- the site descriptorlogger
- logger of the class containing the injection siteInterruptedException
- if interrupted using Thread.interrupt()
public CountDownLatchInjection getLatch(ExecutionControls executionControls, String desc)
ControlsInjector
CountDownLatchInjection
and
org.apache.drill.exec.testing.TestCountDownLatchInjection
for usage.getLatch
in interface ControlsInjector
executionControls
- the controls in the current contextdesc
- the site descriptorCopyright © 1970 The Apache Software Foundation. All rights reserved.