V
- the result typepublic final class NettyResponseFuture<V> extends java.lang.Object implements ListenableFuture<V>
Future
that can be used to track when an asynchronous HTTP request has been fully processed.ListenableFuture.CompletedFailure<T>
Modifier and Type | Field and Description |
---|---|
java.lang.Throwable |
pendingException |
Constructor and Description |
---|
NettyResponseFuture(Request originalRequest,
AsyncHandler<V> asyncHandler,
NettyRequest nettyRequest,
int maxRetry,
ChannelPoolPartitioning connectionPoolPartitioning,
ProxyServer proxyServer) |
Modifier and Type | Method and Description |
---|---|
void |
abort(java.lang.Throwable t)
|
ListenableFuture<V> |
addListener(java.lang.Runnable listener,
java.util.concurrent.Executor exec)
Adds a listener and executor to the ListenableFuture.
|
void |
attachChannel(Channel channel,
boolean reuseChannel) |
boolean |
cancel(boolean force) |
void |
cancelTimeouts() |
Channel |
channel() |
void |
done()
Terminate and if there is no exception, mark this Future as done and release the internal lock.
|
V |
get() |
V |
get(long l,
java.util.concurrent.TimeUnit tu) |
AsyncHandler<V> |
getAsyncHandler() |
ChannelState |
getChannelState() |
ChannelPoolPartitioning |
getConnectionPoolPartitioning() |
Request |
getCurrentRequest() |
long |
getLastTouch() |
NettyRequest |
getNettyRequest() |
java.lang.Object |
getPartitionKey() |
Realm |
getProxyRealm() |
ProxyServer |
getProxyServer() |
Realm |
getRealm() |
long |
getStart() |
Request |
getTargetRequest() |
TimeoutsHolder |
getTimeoutsHolder() |
Uri |
getUri() |
int |
incrementAndGetCurrentRedirectCount() |
boolean |
incrementRetryAndCheck() |
boolean |
isAndSetInAuth(boolean set) |
boolean |
isAndSetInProxyAuth(boolean inProxyAuth) |
boolean |
isAndSetStatusReceived(boolean sr) |
boolean |
isCancelled() |
boolean |
isConnectAllowed() |
boolean |
isDone() |
boolean |
isDontWriteBodyBecauseExpectContinue() |
boolean |
isHeadersAlreadyWrittenOnContinue() |
boolean |
isInAuth() |
boolean |
isInProxyAuth() |
boolean |
isKeepAlive() |
boolean |
isReplayPossible()
Return true if the
Future can be recovered. |
boolean |
isReuseChannel() |
boolean |
isStreamConsumed() |
void |
setAsyncHandler(AsyncHandler<V> asyncHandler) |
void |
setChannelState(ChannelState channelState) |
void |
setConnectAllowed(boolean allowConnect) |
void |
setCurrentRequest(Request currentRequest) |
void |
setDontWriteBodyBecauseExpectContinue(boolean dontWriteBodyBecauseExpectContinue) |
void |
setHeadersAlreadyWrittenOnContinue(boolean headersAlreadyWrittenOnContinue) |
void |
setInAuth(boolean inAuth) |
void |
setInProxyAuth(boolean inProxyAuth) |
void |
setKeepAlive(boolean keepAlive) |
void |
setNettyRequest(NettyRequest nettyRequest) |
void |
setProxyRealm(Realm proxyRealm) |
void |
setRealm(Realm realm) |
void |
setReuseChannel(boolean reuseChannel) |
void |
setStreamConsumed(boolean streamConsumed) |
void |
setTargetRequest(Request targetRequest) |
void |
setTimeoutsHolder(TimeoutsHolder timeoutsHolder) |
java.util.concurrent.CompletableFuture<V> |
toCompletableFuture() |
java.lang.String |
toString() |
void |
touch()
Touch the current instance to prevent external service to times out.
|
public NettyResponseFuture(Request originalRequest, AsyncHandler<V> asyncHandler, NettyRequest nettyRequest, int maxRetry, ChannelPoolPartitioning connectionPoolPartitioning, ProxyServer proxyServer)
public boolean isDone()
isDone
in interface java.util.concurrent.Future<V>
public boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<V>
public boolean cancel(boolean force)
cancel
in interface java.util.concurrent.Future<V>
public V get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<V>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public V get(long l, java.util.concurrent.TimeUnit tu) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<V>
java.lang.InterruptedException
java.util.concurrent.TimeoutException
java.util.concurrent.ExecutionException
public final void done()
ListenableFuture
done
in interface ListenableFuture<V>
public final void abort(java.lang.Throwable t)
ListenableFuture
abort
in interface ListenableFuture<V>
t
- the exceptionpublic void touch()
ListenableFuture
touch
in interface ListenableFuture<V>
public ListenableFuture<V> addListener(java.lang.Runnable listener, java.util.concurrent.Executor exec)
ListenableFuture
Future
's computation is
complete.
null
, in that case executor will be executed
in the thread where completion happens.
addListener
in interface ListenableFuture<V>
listener
- the listener to run when the computation is complete.exec
- the executor to run the listener in.public java.util.concurrent.CompletableFuture<V> toCompletableFuture()
toCompletableFuture
in interface ListenableFuture<V>
public Uri getUri()
public ChannelPoolPartitioning getConnectionPoolPartitioning()
public ProxyServer getProxyServer()
public void setAsyncHandler(AsyncHandler<V> asyncHandler)
public void cancelTimeouts()
public final Request getTargetRequest()
public final Request getCurrentRequest()
public final NettyRequest getNettyRequest()
public final void setNettyRequest(NettyRequest nettyRequest)
public final AsyncHandler<V> getAsyncHandler()
public final boolean isKeepAlive()
public final void setKeepAlive(boolean keepAlive)
public int incrementAndGetCurrentRedirectCount()
public void setTimeoutsHolder(TimeoutsHolder timeoutsHolder)
public TimeoutsHolder getTimeoutsHolder()
public boolean isInAuth()
public void setInAuth(boolean inAuth)
public boolean isAndSetInAuth(boolean set)
public boolean isInProxyAuth()
public void setInProxyAuth(boolean inProxyAuth)
public boolean isAndSetInProxyAuth(boolean inProxyAuth)
public ChannelState getChannelState()
public void setChannelState(ChannelState channelState)
public boolean isAndSetStatusReceived(boolean sr)
public boolean isStreamConsumed()
public void setStreamConsumed(boolean streamConsumed)
public long getLastTouch()
public void setHeadersAlreadyWrittenOnContinue(boolean headersAlreadyWrittenOnContinue)
public boolean isHeadersAlreadyWrittenOnContinue()
public void setDontWriteBodyBecauseExpectContinue(boolean dontWriteBodyBecauseExpectContinue)
public boolean isDontWriteBodyBecauseExpectContinue()
public void setReuseChannel(boolean reuseChannel)
public boolean isConnectAllowed()
public void setConnectAllowed(boolean allowConnect)
public void attachChannel(Channel channel, boolean reuseChannel)
public Channel channel()
public boolean isReuseChannel()
public boolean incrementRetryAndCheck()
public void setTargetRequest(Request targetRequest)
public void setCurrentRequest(Request currentRequest)
public boolean isReplayPossible()
Future
can be recovered. There is some scenario where a connection can be closed by an unexpected IOException, and in some situation we can
recover from that exception.Future
cannot be recovered.public long getStart()
public java.lang.Object getPartitionKey()
public Realm getRealm()
public void setRealm(Realm realm)
public Realm getProxyRealm()
public void setProxyRealm(Realm proxyRealm)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2017. All Rights Reserved.