From the course: Spring: Spring MVC

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

DeferredResult implementation for async

DeferredResult implementation for async

From the course: Spring: Spring MVC

Start my 1-month free trial

DeferredResult implementation for async

- [Instructor] Let us also see the demo of async processing with deferred result of string as a return type from your controllers. So let's go back to the IDE, and inside our search controller instead of returning a callable of string on line number 24 this time I'm going to return a deferred result of string, so let's do that first, like that. And we will have to create an instance of this deferred result right out here. This will be of string, let's create a variable and instantiate this. Okay, now we have already seen the implementation with callable. Callable is executed concurrently on behalf of the application, but when you use a deferred result the application can produce the result from a thread of its choice, which means that this deferred result object that is being utilized now, we are supposed to manage the threads for it. We have the choice of managing the threads for it. Now what I'm going to do is on…

Contents