Building managed threads with returning results
Sometimes you need to improve the way you look at the threads you are using; maybe to improve your logging features, maybe to manage their priorities. It would be nice if you could also get the results back from them. This recipe will show you how to do it.
Getting ready
Let's first add our Java EE 8 dependency:
<dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>8.0</version> <scope>provided</scope> </dependency>
How to do it...
- Let's first create a
User
POJO:
public class User { private Long id; private String name; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public User(Long id, String...