Result - The type of the result of the process.public interface Callback<Result>
Callback is used, to convey that result from the executor of the
process (hereafter: executor) back to the initiator of the process
(hereafter: initiator).
A Callback is most likely, but not necessarily, used in a
multithreaded scenario.
Depending on the concrete scenario, the initiator may reuse the same instance
of Callback for multiple processes and even for the same executor,
although the letter is unusual.
The executor must eventually call onResult(Object), at least
once.
One common exception to this rule is, when the executor can ensure, that the
result wont't be needed by the initiator, because the initiator itself is not
needed anymore. This is usually implemented by placing the Callback
in a WeakReference. This should be noted in the contract of the
method, that is used to convey the Callback to the executor, because
using anonymous instances of Callback will fail in this case.
The executor may call onResult(Object), more than once,
depending o the concrete scenario, to convey partial or updated results. This
should be noted in the contract of the method, that is used to convey the
Callback to the executor.
The executor must not call onResult(Object) more than once
for the same result.
| Modifier and Type | Method and Description |
|---|---|
void |
onResult(Result result)
Called by the executor when a result is available.
|
void onResult(Result result)
result - The result.Copyright © 2015–2016 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.