|
Generated by JDiff |
||||||||
PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES |
This file contains all the changes in documentation in the packageorg.springframework.web.context.request.async
as colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
Add aRunnablehandle tobeinvokeinvokedwhen request processing completes.
{@code DeferredResult} provides an alternative to using a Callable for asynchronous request processing. While a {@code Callable} isClass DeferredResult, constructor DeferredResult(Long, Object)executed concurrentlyexecuted concurrently on behalf of the application, with a {@code DeferredResult}thethe application canproduceproduce the result from a thread of its choice. @author Rossen Stoyanchev @since 3.2
Create a DeferredResult with a timeout value and a default result toClass DeferredResult, constructor DeferredResult(long)useuse in caseonof timeout. @param timeout timeout value in milliseconds; ignored if {@code null} @param timeoutResult the result to use, possibly {@code null}
Create a DeferredResult with a timeout value. @param timeout timeout value in millisecondsClass DeferredResult, boolean isSetOrExpired()
Class DeferredResult, boolean setErrorResult(Object)WhetherReturnthe{@code true} if this DeferredResultcanis no longerbeusable either because it was previously seteitheror because theasyncunderlying request expired.The
result may have been set with a call to .setResult(Object), orbecause.setErrorResult(Object),itor as a result of a timeout, if a timeout result wasalreadyprovidedsetto the constructor. The request may also expire due to a timeout or network error.
Set an errorClass DeferredResult, boolean setResult(T)resultvalueand passfor theitDeferredResulton for handlingand handle it.IfThethe result is anvalue may be an Exception or Throwable, it will be processed as though the controller raisedtheinexception.whichOtherwisecase it willbebe processed as ifthe controller returneda handler raised thegiven resultexception. @param result the error result value @return "true" if the result was set to the error value and passed onforfor handling;"false" if the result was already set or the asyncrequestrequest expired. @see #isSetOrExpired()
Set theClass DeferredResult, void setResultHandler(DeferredResultHandler)resultvalueand pass it on for handlingfor the DeferredResult and handle it. @param result theresultvalue tovalueset @return "true" if the result was set and passed on for handling;"false" if the result was already set or the async request expired. @see #isSetOrExpired()
SetProvide a handler to use to handle the resultwhen setvalue.Normally applications do notuse this method at@paramruntimeresultHandlerbut may dothesohandlerduring@seetesting.DeferredResultProcessingInterceptor
The central class for managing asynchronous request processing, mainly intended as an SPI and not typically used directly by application classes.Class WebAsyncManager, Object getConcurrentResult()An async scenario starts with request processing as usual in a thread (T1). Concurrent request handling can be innitiated by calling #startCallableProcessing(Callable, Object...) startCallableProcessing or #startDeferredResultProcessing(DeferredResult, Object...) startDeferredResultProcessing both of which produce a result in a separate thread (T2). The result is saved and the request dispatched to the container, to resume processing with the saved result in a third thread (T3). Within the dispatched thread (T3), the saved result can be accessed via .getConcurrentResult() or its presence detected via .hasConcurrentResult().
TODO .. Servlet 3 config@author Rossen Stoyanchev @since 3.2 @see org.springframework.web.context.request.AsyncWebRequestInterceptor @see org.springframework.web.servlet.AsyncHandlerInterceptor @see org.springframework.web.filter.OncePerRequestFilter#shouldFilterAsyncDispatches @see org.springframework.web.filter.OncePerRequestFilter#isAsyncDispatch @see org.springframework.web.filter.OncePerRequestFilter#isLastRequestThread
Provides access to the result from concurrent handling.Class WebAsyncManager, Object[] getConcurrentResultContext()@return an Object, possibly an {@code Exception} or {@code Throwable} ifconcurrentconcurrent handling raised one. @see #clearConcurrentResult()
Provides access to additional processing context saved at the start of concurrent handling. @see #clearConcurrentResult()Class WebAsyncManager, boolean hasConcurrentResult()
WhetherClass WebAsyncManager, void setAsyncWebRequest(AsyncWebRequest)thearequest has beenresultdispatched to process thevalue exists as a resultofof concurrent handling.
Configure the AsyncWebRequest to use. This property mayClass WebAsyncManager, void startCallableProcessing(Callable<?>, Object[])be setbe set more than once during a single request to accurately reflectthethecurrentcurrent state of the request (e.g. following a forward, request/response wrapping, etc). However, it should not be set while concurrenthandlinghandlingisis in progress, i.e. while .isConcurrentHandlingStarted()isis {@code true}.@param asyncWebRequest the web request to use
Start concurrent request processing and execute the given task with an AsyncTaskExecutor. The result from the task execution is saved and the request dispatched in order to resume processing of that result. If the task raises an Exception then the saved result will be the raised Exception. @param callable a unit of work to be executed asynchronously @param processingContext additional context to save that can be accessedClass WebAsyncManager, void startCallableProcessing(MvcAsyncTask<?>, Object[])viavia .getConcurrentResultContext() @see #getConcurrentResult() @see #getConcurrentResultContext()
Use the givenClass WebAsyncManager, void startDeferredResultProcessing(DeferredResult<?>, Object[])AsyncTaskMvcAsyncTask to configure the task executor as well as the timeout value of the {@code AsyncWebRequest} before delegating to .startCallableProcessing(Callable, Object...).@paramasyncTaskmvcAsyncTask anasyncTaskMvcAsyncTask containing the target {@code Callable} @param processingContext additional context to save that can be accessedviavia .getConcurrentResultContext()
Start concurrent request processing and initialize thegivengiven DeferredResultwith a DeferredResultHandler thatsavessaves the result anddispatchesdispatches the request to resume processing ofthatthat result.The {@code AsyncWebRequest} is also updated with acompletioncompletion handlerthatthat expires the {@code DeferredResult} and a timeouthandlerhandler assumingthethe {@code DeferredResult} has a default timeout result. @param deferredResult the DeferredResult instance to initialize @param processingContext additional context to save that can be accessedviavia .getConcurrentResultContext() @see #getConcurrentResult() @see #getConcurrentResultContext()