Package org.asynchttpclient.netty
Class NettyResponseFuture<V>
- java.lang.Object
- 
- org.asynchttpclient.netty.NettyResponseFuture<V>
 
- 
- Type Parameters:
- V- the result type
 - All Implemented Interfaces:
- Future<V>,- ListenableFuture<V>
 
 public final class NettyResponseFuture<V> extends Object implements ListenableFuture<V> AFuturethat can be used to track when an asynchronous HTTP request has been fully processed.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.asynchttpclient.ListenableFutureListenableFuture.CompletedFailure<T>
 
- 
 - 
Field SummaryFields Modifier and Type Field Description ThrowablependingException
 - 
Constructor SummaryConstructors Constructor Description NettyResponseFuture(Request originalRequest, AsyncHandler<V> asyncHandler, NettyRequest nettyRequest, int maxRetry, ChannelPoolPartitioning connectionPoolPartitioning, ConnectionSemaphore connectionSemaphore, ProxyServer proxyServer)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(Throwable t)voidacquirePartitionLockLazily()ListenableFuture<V>addListener(Runnable listener, Executor exec)Adds a listener and executor to the ListenableFuture.voidattachChannel(io.netty.channel.Channel channel, boolean reuseChannel)booleancancel(boolean force)voidcancelTimeouts()io.netty.channel.Channelchannel()voiddone()Terminate and if there is no exception, mark this Future as done and release the internal lock.Vget()Vget(long l, TimeUnit tu)AsyncHandler<V>getAsyncHandler()ChannelStategetChannelState()RequestgetCurrentRequest()longgetLastTouch()NettyRequestgetNettyRequest()ObjectgetPartitionKey()RealmgetProxyRealm()ProxyServergetProxyServer()RealmgetRealm()longgetStart()RequestgetTargetRequest()TimeoutsHoldergetTimeoutsHolder()UrigetUri()intincrementAndGetCurrentRedirectCount()booleanincrementRetryAndCheck()booleanisAndSetInAuth(boolean set)booleanisAndSetInProxyAuth(boolean inProxyAuth)booleanisCancelled()booleanisConnectAllowed()booleanisDone()booleanisDontWriteBodyBecauseExpectContinue()booleanisHeadersAlreadyWrittenOnContinue()booleanisInAuth()booleanisInProxyAuth()booleanisKeepAlive()booleanisReplayPossible()Return true if theFuturecan be recovered.booleanisReuseChannel()booleanisStreamConsumed()voidsetAsyncHandler(AsyncHandler<V> asyncHandler)voidsetChannelState(ChannelState channelState)voidsetConnectAllowed(boolean allowConnect)voidsetCurrentRequest(Request currentRequest)voidsetDontWriteBodyBecauseExpectContinue(boolean dontWriteBodyBecauseExpectContinue)voidsetHeadersAlreadyWrittenOnContinue(boolean headersAlreadyWrittenOnContinue)voidsetInAuth(boolean inAuth)voidsetInProxyAuth(boolean inProxyAuth)voidsetKeepAlive(boolean keepAlive)voidsetNettyRequest(NettyRequest nettyRequest)voidsetProxyRealm(Realm proxyRealm)voidsetRealm(Realm realm)voidsetReuseChannel(boolean reuseChannel)voidsetStreamConsumed(boolean streamConsumed)voidsetTargetRequest(Request targetRequest)voidsetTimeoutsHolder(TimeoutsHolder timeoutsHolder)ObjecttakePartitionKeyLock()CompletableFuture<V>toCompletableFuture()StringtoString()voidtouch()Touch the current instance to prevent external service to times out.
 
- 
- 
- 
Field Detail- 
pendingExceptionpublic Throwable pendingException 
 
- 
 - 
Constructor Detail- 
NettyResponseFuturepublic NettyResponseFuture(Request originalRequest, AsyncHandler<V> asyncHandler, NettyRequest nettyRequest, int maxRetry, ChannelPoolPartitioning connectionPoolPartitioning, ConnectionSemaphore connectionSemaphore, ProxyServer proxyServer) 
 
- 
 - 
Method Detail- 
takePartitionKeyLockpublic Object takePartitionKeyLock() 
 - 
isCancelledpublic boolean isCancelled() - Specified by:
- isCancelledin interface- Future<V>
 
 - 
getpublic V get() throws InterruptedException, ExecutionException - Specified by:
- getin interface- Future<V>
- Throws:
- InterruptedException
- ExecutionException
 
 - 
getpublic V get(long l, TimeUnit tu) throws InterruptedException, TimeoutException, ExecutionException - Specified by:
- getin interface- Future<V>
- Throws:
- InterruptedException
- TimeoutException
- ExecutionException
 
 - 
donepublic void done() Description copied from interface:ListenableFutureTerminate and if there is no exception, mark this Future as done and release the internal lock.- Specified by:
- donein interface- ListenableFuture<V>
 
 - 
abortpublic void abort(Throwable t) Description copied from interface:ListenableFuture- Specified by:
- abortin interface- ListenableFuture<V>
- Parameters:
- t- the exception
 
 - 
touchpublic void touch() Description copied from interface:ListenableFutureTouch the current instance to prevent external service to times out.- Specified by:
- touchin interface- ListenableFuture<V>
 
 - 
addListenerpublic ListenableFuture<V> addListener(Runnable listener, Executor exec) Description copied from interface:ListenableFutureAdds a listener and executor to the ListenableFuture. The listener will be passed to the executor for execution when theFuture's computation is complete.
 Executor can benull, in that case executor will be executed in the thread where completion happens.
 There is no guaranteed ordering of execution of listeners, they may get called in the order they were added, and they may get called out of order, but any listener added through this method is guaranteed to be called once the computation is complete.- Specified by:
- addListenerin interface- ListenableFuture<V>
- Parameters:
- listener- the listener to run when the computation is complete.
- exec- the executor to run the listener in.
- Returns:
- this Future
 
 - 
toCompletableFuturepublic CompletableFuture<V> toCompletableFuture() - Specified by:
- toCompletableFuturein interface- ListenableFuture<V>
 
 - 
getUripublic Uri getUri() 
 - 
getProxyServerpublic ProxyServer getProxyServer() 
 - 
cancelTimeoutspublic void cancelTimeouts() 
 - 
getTargetRequestpublic Request getTargetRequest() 
 - 
setTargetRequestpublic void setTargetRequest(Request targetRequest) 
 - 
getCurrentRequestpublic Request getCurrentRequest() 
 - 
setCurrentRequestpublic void setCurrentRequest(Request currentRequest) 
 - 
getNettyRequestpublic NettyRequest getNettyRequest() 
 - 
setNettyRequestpublic void setNettyRequest(NettyRequest nettyRequest) 
 - 
getAsyncHandlerpublic AsyncHandler<V> getAsyncHandler() 
 - 
setAsyncHandlerpublic void setAsyncHandler(AsyncHandler<V> asyncHandler) 
 - 
isKeepAlivepublic boolean isKeepAlive() 
 - 
setKeepAlivepublic void setKeepAlive(boolean keepAlive) 
 - 
incrementAndGetCurrentRedirectCountpublic int incrementAndGetCurrentRedirectCount() 
 - 
getTimeoutsHolderpublic TimeoutsHolder getTimeoutsHolder() 
 - 
setTimeoutsHolderpublic void setTimeoutsHolder(TimeoutsHolder timeoutsHolder) 
 - 
isInAuthpublic boolean isInAuth() 
 - 
setInAuthpublic void setInAuth(boolean inAuth) 
 - 
isAndSetInAuthpublic boolean isAndSetInAuth(boolean set) 
 - 
isInProxyAuthpublic boolean isInProxyAuth() 
 - 
setInProxyAuthpublic void setInProxyAuth(boolean inProxyAuth) 
 - 
isAndSetInProxyAuthpublic boolean isAndSetInProxyAuth(boolean inProxyAuth) 
 - 
getChannelStatepublic ChannelState getChannelState() 
 - 
setChannelStatepublic void setChannelState(ChannelState channelState) 
 - 
isStreamConsumedpublic boolean isStreamConsumed() 
 - 
setStreamConsumedpublic void setStreamConsumed(boolean streamConsumed) 
 - 
getLastTouchpublic long getLastTouch() 
 - 
isHeadersAlreadyWrittenOnContinuepublic boolean isHeadersAlreadyWrittenOnContinue() 
 - 
setHeadersAlreadyWrittenOnContinuepublic void setHeadersAlreadyWrittenOnContinue(boolean headersAlreadyWrittenOnContinue) 
 - 
isDontWriteBodyBecauseExpectContinuepublic boolean isDontWriteBodyBecauseExpectContinue() 
 - 
setDontWriteBodyBecauseExpectContinuepublic void setDontWriteBodyBecauseExpectContinue(boolean dontWriteBodyBecauseExpectContinue) 
 - 
isConnectAllowedpublic boolean isConnectAllowed() 
 - 
setConnectAllowedpublic void setConnectAllowed(boolean allowConnect) 
 - 
attachChannelpublic void attachChannel(io.netty.channel.Channel channel, boolean reuseChannel)
 - 
channelpublic io.netty.channel.Channel channel() 
 - 
isReuseChannelpublic boolean isReuseChannel() 
 - 
setReuseChannelpublic void setReuseChannel(boolean reuseChannel) 
 - 
incrementRetryAndCheckpublic boolean incrementRetryAndCheck() 
 - 
isReplayPossiblepublic boolean isReplayPossible() Return true if theFuturecan 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.- Returns:
- true if that Futurecannot be recovered.
 
 - 
getStartpublic long getStart() 
 - 
getPartitionKeypublic Object getPartitionKey() 
 - 
acquirePartitionLockLazilypublic void acquirePartitionLockLazily() throws IOException- Throws:
- IOException
 
 - 
getRealmpublic Realm getRealm() 
 - 
setRealmpublic void setRealm(Realm realm) 
 - 
getProxyRealmpublic Realm getProxyRealm() 
 - 
setProxyRealmpublic void setProxyRealm(Realm proxyRealm) 
 
- 
 
-