public abstract class ResultCallbackTemplate<RC_T extends ResultCallback<A_RES_T>,A_RES_T> extends Object implements ResultCallback<A_RES_T>
ResultCallback| 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() was called. |
boolean |
awaitStarted(long timeout,
TimeUnit timeUnit)
Blocks until
ResultCallback#onStart() was called or the given timeout occurs. |
void |
close() |
protected RuntimeException |
getFirstError() |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonNextpublic void onStart(Closeable stream)
ResultCallbackCloseable can be
used to close/interrupt the processing.onStart in interface ResultCallback<A_RES_T>public void onError(Throwable throwable)
ResultCallbackonError in interface ResultCallback<A_RES_T>public void onComplete()
ResultCallbackonComplete in interface ResultCallback<A_RES_T>public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic RC_T awaitCompletion() throws InterruptedException
ResultCallback.onComplete() was calledInterruptedExceptionpublic 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.InterruptedExceptionpublic RC_T awaitStarted() throws InterruptedException
ResultCallback#onStart() was called. ResultCallback#onStart() is called when the request was processed
on the server side and the response is incoming.InterruptedExceptionpublic boolean awaitStarted(long timeout,
TimeUnit timeUnit)
throws InterruptedException
ResultCallback#onStart() was called or the given timeout occurs. ResultCallback#onStart() 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() was called.InterruptedException@CheckForNull protected RuntimeException getFirstError()
Copyright © 2017. All Rights Reserved.