public class Ensure extends Object
step(nr)
with
steps starting at 1. You can also have threads wait until you arrive at a
certain step.
Taken from Apache Felix Dependency Manager. (C) Copyright 2010-11 Apache Felix Project.
Constructor and Description |
---|
Ensure()
Creates a new Ensure object.
|
Ensure(boolean aDebug)
Creates a new Ensure object.
|
Modifier and Type | Method and Description |
---|---|
static Runnable |
createRunnableStep(Ensure aEnsure,
int aNr)
Factory method to create a runnable step that steps to the given number.
|
void |
setStream(PrintStream aOutput)
Sets the output stream for printing the results of steps to.
|
void |
step()
Mark this point as the next step.
|
void |
step(int aNr)
Mark this point as step
nr . |
void |
waitForStep(int aNr,
int aTimeout)
Wait until we arrive at least at step
nr in the process, or
fail if that takes more than timeout milliseconds. |
public Ensure()
public Ensure(boolean aDebug)
aDebug
- true
to output more information about the steps this
class enters/waits for, false
otherwise.public static Runnable createRunnableStep(Ensure aEnsure, int aNr)
aEnsure
- the ensure class to use for setting the step;aNr
- the number to set upon invoking the returned runnable.public void setStream(PrintStream aOutput)
aOutput
- the print stream to set, cannot be null
.IllegalArgumentException
- in case the given stream was null
.public void step()
public void step(int aNr)
nr
.aNr
- the step we are in.public void waitForStep(int aNr, int aTimeout)
nr
in the process, or
fail if that takes more than timeout
milliseconds. If you
invoke wait on a thread, you are effectively assuming some other thread
will invoke the step(nr)
method.aNr
- the step to wait foraTimeout
- the number of milliseconds to waitIllegalStateException
- in case current step isn't the step we expected.Copyright © 2015 L'Xtreme IT consultancy. All rights reserved.