public abstract class ResultCallbackTemplate<RC_T extends ResultCallback<A_RES_T>,A_RES_T> extends Object implements ResultCallback<A_RES_T>
ResultCallback
ResultCallback.Adapter<A_RES_T>
Constructor and Description |
---|
ResultCallbackTemplate() |
Modifier and Type | Method and Description |
---|---|
RC_T |
awaitCompletion()
Blocks until
ResultCallback.onComplete() was called |
boolean |
awaitCompletion(long timeout,
TimeUnit timeUnit)
Blocks until
ResultCallback.onComplete() was called or the given timeout occurs |
RC_T |
awaitStarted()
Blocks until
ResultCallback.onStart(Closeable) was called. |
boolean |
awaitStarted(long timeout,
TimeUnit timeUnit)
Blocks until
ResultCallback.onStart(Closeable) was called or the given timeout occurs. |
void |
close() |
void |
onComplete()
Called when processing was finished either by reaching the end or by aborting it
|
void |
onError(Throwable throwable)
Called when an exception occurs while processing
|
void |
onStart(Closeable stream)
Called when the async processing starts respectively when the response arrives from the server.
|
protected void |
throwFirstError()
Throws the first occurred error as a runtime exception
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onNext
public void onStart(Closeable stream)
ResultCallback
Closeable
can be
used to close/interrupt the processing.onStart
in interface ResultCallback<A_RES_T>
public void onError(Throwable throwable)
ResultCallback
onError
in interface ResultCallback<A_RES_T>
public void onComplete()
ResultCallback
onComplete
in interface ResultCallback<A_RES_T>
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public RC_T awaitCompletion() throws InterruptedException
ResultCallback.onComplete()
was calledInterruptedException
public boolean awaitCompletion(long timeout, TimeUnit timeUnit) throws InterruptedException
ResultCallback.onComplete()
was called or the given timeout occurstrue
if completed and false
if the waiting time elapsed
before ResultCallback.onComplete()
was called.InterruptedException
public RC_T awaitStarted() throws InterruptedException
ResultCallback.onStart(Closeable)
was called.
ResultCallback.onStart(Closeable)
is called when the request was processed on the server
side and the response is incoming.InterruptedException
public boolean awaitStarted(long timeout, TimeUnit timeUnit) throws InterruptedException
ResultCallback.onStart(Closeable)
was called or the given timeout occurs.
ResultCallback.onStart(Closeable)
is called when the request was processed on the server side
and the response is incoming.true
if started and false
if the waiting time elapsed
before ResultCallback.onStart(Closeable)
was called.InterruptedException
protected void throwFirstError()
DockerException
- The first docker based ErrorRuntimeException
- on any other occurred errorCopyright © 2021. All rights reserved.