Modifier and Type | Class and Description |
---|---|
static interface |
Waiter.ExplainingPredicate<E extends Exception>
A mixin interface, can be used with
Waiter to explain failed state. |
static interface |
Waiter.Predicate<E extends Exception>
A predicate 'closure' used by the
waitFor(Configuration, long, Predicate) and
waitFor(Configuration, long, Predicate) and
waitFor(Configuration, long, long, boolean, Predicate) methods. |
Modifier and Type | Field and Description |
---|---|
static String |
HBASE_TEST_WAIT_FOR_RATIO
System property name whose value is a scale factor to increase time out values dynamically used
in
sleep(Configuration, long) , waitFor(Configuration, long, Predicate) ,
waitFor(Configuration, long, long, Predicate) , and
waitFor(Configuration, long, long, boolean, Predicate) method
The actual time out value will equal to hbase.test.wait.for.ratio * passed-in timeout |
private static float |
HBASE_WAIT_FOR_RATIO_DEFAULT |
private static org.slf4j.Logger |
LOG |
private static float |
waitForRatio |
Modifier | Constructor and Description |
---|---|
private |
Waiter() |
Modifier and Type | Method and Description |
---|---|
static String |
getExplanation(Waiter.Predicate<?> explain) |
static float |
getWaitForRatio(org.apache.hadoop.conf.Configuration conf)
Returns the 'wait for ratio' used in the
sleep(Configuration, long) ,
waitFor(Configuration, long, Predicate) ,
waitFor(Configuration, long, long, Predicate) and
waitFor(Configuration, long, long, boolean, Predicate) methods of the class
This is useful to dynamically adjust max time out values when same test cases run in different
test machine settings without recompiling & re-deploying code. |
static void |
sleep(org.apache.hadoop.conf.Configuration conf,
long time)
Makes the current thread sleep for the duration equal to the specified time in milliseconds
multiplied by the
getWaitForRatio(Configuration) . |
static <E extends Exception> |
waitFor(org.apache.hadoop.conf.Configuration conf,
long timeout,
long interval,
boolean failIfTimeout,
Waiter.Predicate<E> predicate)
Waits up to the duration equal to the specified timeout multiplied by the
getWaitForRatio(Configuration) for the given Waiter.Predicate to become
true , failing the test if the timeout is reached, the Predicate is still
false and failIfTimeout is set as true . |
static <E extends Exception> |
waitFor(org.apache.hadoop.conf.Configuration conf,
long timeout,
long interval,
Waiter.Predicate<E> predicate)
Waits up to the duration equal to the specified timeout multiplied by the
getWaitForRatio(Configuration) for the given Waiter.Predicate to become
true , failing the test if the timeout is reached and the Predicate is still
false . |
static <E extends Exception> |
waitFor(org.apache.hadoop.conf.Configuration conf,
long timeout,
Waiter.Predicate<E> predicate)
Waits up to the duration equal to the specified timeout multiplied by the
getWaitForRatio(Configuration) for the given Waiter.Predicate to become
true , failing the test if the timeout is reached and the Predicate is still
false . |
private static final org.slf4j.Logger LOG
public static final String HBASE_TEST_WAIT_FOR_RATIO
sleep(Configuration, long)
, waitFor(Configuration, long, Predicate)
,
waitFor(Configuration, long, long, Predicate)
, and
waitFor(Configuration, long, long, boolean, Predicate)
method
The actual time out value will equal to hbase.test.wait.for.ratio * passed-in timeoutprivate static float HBASE_WAIT_FOR_RATIO_DEFAULT
private static float waitForRatio
private Waiter()
public static float getWaitForRatio(org.apache.hadoop.conf.Configuration conf)
sleep(Configuration, long)
,
waitFor(Configuration, long, Predicate)
,
waitFor(Configuration, long, long, Predicate)
and
waitFor(Configuration, long, long, boolean, Predicate)
methods of the class
This is useful to dynamically adjust max time out values when same test cases run in different
test machine settings without recompiling & re-deploying code.
The value is obtained from the Java System property or configuration setting
hbase.test.wait.for.ratio
which defaults to 1
.conf
- the configurationpublic static void sleep(org.apache.hadoop.conf.Configuration conf, long time)
getWaitForRatio(Configuration)
.conf
- the configurationtime
- the number of milliseconds to sleep.public static <E extends Exception> long waitFor(org.apache.hadoop.conf.Configuration conf, long timeout, Waiter.Predicate<E> predicate)
getWaitForRatio(Configuration)
for the given Waiter.Predicate
to become
true
, failing the test if the timeout is reached and the Predicate is still
false
.
conf
- the configurationtimeout
- the timeout in milliseconds to wait for the predicate.predicate
- the predicate to evaluate.true
or
wait is interrupted otherwise -1
when times outpublic static <E extends Exception> long waitFor(org.apache.hadoop.conf.Configuration conf, long timeout, long interval, Waiter.Predicate<E> predicate)
getWaitForRatio(Configuration)
for the given Waiter.Predicate
to become
true
, failing the test if the timeout is reached and the Predicate is still
false
.
conf
- the configurationtimeout
- the max timeout in milliseconds to wait for the predicate.interval
- the interval in milliseconds to evaluate predicate.predicate
- the predicate to evaluate.true
or
wait is interrupted otherwise -1
when times outpublic static <E extends Exception> long waitFor(org.apache.hadoop.conf.Configuration conf, long timeout, long interval, boolean failIfTimeout, Waiter.Predicate<E> predicate)
getWaitForRatio(Configuration)
for the given Waiter.Predicate
to become
true
, failing the test if the timeout is reached, the Predicate is still
false
and failIfTimeout is set as true
.
conf
- the configurationtimeout
- the timeout in milliseconds to wait for the predicate.interval
- the interval in milliseconds to evaluate predicate.failIfTimeout
- indicates if should fail current test case when times out.predicate
- the predicate to evaluate.true
or
wait is interrupted otherwise -1
when times outpublic static String getExplanation(Waiter.Predicate<?> explain)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.