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 |
RC_T |
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. |
RC_T |
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, 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 RC_T awaitCompletion(long timeout, TimeUnit timeUnit) throws InterruptedException
ResultCallback.onComplete()
was called or the given timeout occursInterruptedException
public 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.InterruptedException
public RC_T 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.InterruptedException
@CheckForNull protected RuntimeException getFirstError()
Copyright © 2016. All Rights Reserved.