@Beta @PublicAPI public final class ProgressObservers extends Object
Please note that this class is marked with @Beta annotation, so it can be subject of incompatible changes or removal in any of the later releases.
Modifier and Type | Method and Description |
---|---|
static CancelObserver |
anyCancelled(CancelObserver... cancelObservers)
Returns a cancel observer which cancels when any of the specified observer is cancelled.
|
static SubProgressObserver |
createForgivingNullObserver()
Deprecated.
Use
nullProgressObserver() instead. |
static CancelObserver |
createNoCancelObserver()
Deprecated.
Use
noCanceller() |
static SubProgressObserver |
createNullObserver(String taskName)
Deprecated.
|
static SubProgressObserver |
createStrictNullObserver()
Returns a SubProgressObserver which ignores observed data.
|
static CancelObserver |
noCanceller()
Returns a cancel observer which wont cancel execution.
|
static SubProgressObserver |
nullProgressObserver()
Returns a forgiving observer which wont enforce API contracts.
|
static SubProgressObserver |
nullProgressObserver(CancelObserver canceller)
Returns a forgiving cancellable observer which wont enforce API contracts.
|
static CancelObserver |
orTimeout(CancelObserver cancelObserver,
long timeoutInSeconds)
Returns a cancel observer which cancels when a passed observer is cancelled or a timeout occured.
|
static CancelObserver |
timeoutCanceller(long timeoutInSeconds)
Returns a cancel observer which cancels after a specified timeout.
|
public static SubProgressObserver createStrictNullObserver()
API contract is still enforced, eg. IllegalStateException
is thrown on API contract breaches from the
observed code.
@Deprecated public static SubProgressObserver createNullObserver(String taskName)
createStrictNullObserver()
.
API contract is still enforced, eg. IllegalStateException
is thrown on API contract breaches from the
observed code.
taskName
- Name of observed subtaskpublic static CancelObserver noCanceller()
public static CancelObserver timeoutCanceller(long timeoutInSeconds)
System.currentTimeMillis()
upon every invocation of its
CancelObserver.isCancelled()
method.timeoutInSeconds
- Timeout in seconds. Use 0
for no timeout.noCanceller()
when 0
timeout is specifiedpublic static CancelObserver anyCancelled(CancelObserver... cancelObservers)
cancelObservers
- Observers to watch. Note that null
is acceptedpublic static CancelObserver orTimeout(CancelObserver cancelObserver, long timeoutInSeconds)
cancelObserver
- Base observer, can be null
timeoutInSeconds
- Timeout in seconds; use 0
for no timeout@Deprecated public static CancelObserver createNoCancelObserver()
noCanceller()
public static SubProgressObserver nullProgressObserver()
SubProgressObserver
which wont enforce API contracts and wont cancel@Deprecated public static SubProgressObserver createForgivingNullObserver()
nullProgressObserver()
instead.SubProgressObserver
which wont enforce API contracts and wont cancelpublic static SubProgressObserver nullProgressObserver(CancelObserver canceller)
Note that current implementation polls cancelling upon method calls. If an observed code expects cancelling only through listener callbacks and wont call other methods (progress update) cancel event wont be generated.
canceller
- Underlying canceller polled at every operationSubProgressObserver
which wont enforce API contracts and propagates cancellinkg