{ id: 1
type: newMessage,
text: "Hello, world!"}
{ id: 2,
type: updateMessage,
idToUpdate: 1,
newText: "Hello, Dear User!"}
{ id: 3,
type: deleteMessage,
idToDelete: 1}
DeferredResult provides an alternative to using a Callable for asynchronous request processing. While a Callable is executed concurrently on behalf of the application, with a DeferredResult the application can produce the result from a thread of its choice.
Subclasses can extend this class to easily associate additional data or behavior with the DeferredResult. For example, one might want to associate the user used to create the DeferredResult by extending the class and adding an additional property for the user. In this way, the user could easily be accessed later without the need to use a data structure to do the mapping.
An example of associating additional behavior to this class might be realized by extending the class to implement an additional interface. For example, one might want to implement Comparable so that when the DeferredResult is added to a PriorityQueue it is handled in the correct order.
По факту заметил, что с DiferredRestult могу указывать сам пул потоков, а с Callable нет.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.11.Final</version>
</dependency>
@RequestScope, @SessionScope, @Lazy
и прочее..