public abstract class IteratingCallback extends Object implements Callback
process()
where the sub
task is executed and a suitable IteratingCallback.Action
is
returned to this callback to indicate the overall progress of the job.
This callback is passed to the asynchronous execution of each sub
task and a call the succeeded()
on this callback represents
the completion of the sub task.Modifier and Type | Class and Description |
---|---|
protected static class |
IteratingCallback.Action
The indication of the overall progress of the overall job that
implementations of
process() must return. |
Callback.Adapter
Modifier | Constructor and Description |
---|---|
protected |
IteratingCallback() |
protected |
IteratingCallback(boolean needReset) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
completed()
Deprecated.
Use
onCompleteSuccess() instead. |
void |
failed(Throwable x)
Invoked when the sub task fails.
|
boolean |
isClosed() |
boolean |
isFailed() |
boolean |
isSucceeded() |
void |
iterate()
This method must be invoked by applications to start the processing
of sub tasks.
|
protected void |
onCompleteFailure(Throwable x)
Invoked when the overall task has completed with a failure.
|
protected void |
onCompleteSuccess()
Invoked when the overall task has completed successfully.
|
protected abstract IteratingCallback.Action |
process()
Method called by
iterate() to process the sub task. |
boolean |
reset()
Resets this callback.
|
void |
succeeded()
Invoked when the sub task succeeds.
|
String |
toString() |
protected IteratingCallback()
protected IteratingCallback(boolean needReset)
protected abstract IteratingCallback.Action process() throws Exception
iterate()
to process the sub task.
Implementations must start the asynchronous execution of the sub task
(if any) and return an appropriate action:
IteratingCallback.Action.IDLE
when no sub tasks are available for execution
but the overall job is not completed yetIteratingCallback.Action.SCHEDULED
when the sub task asynchronous execution
has been startedIteratingCallback.Action.SUCCEEDED
when the overall job is completedException
- if the sub task processing throws@Deprecated protected void completed()
onCompleteSuccess()
instead.protected void onCompleteSuccess()
onCompleteFailure(Throwable)
protected void onCompleteFailure(Throwable x)
onCompleteSuccess()
public void iterate()
process()
method will
be called during or soon after, either by the calling thread or by
another thread.public void succeeded()
super.succeeded()
.succeeded
in interface Callback
Callback.failed(Throwable)
public void failed(Throwable x)
super.failed(Throwable)
.public void close()
public boolean isClosed()
public boolean isFailed()
public boolean isSucceeded()
public boolean reset()
Copyright © 1995-2015 Webtide. All Rights Reserved.