April 2018
Intermediate to advanced
382 pages
10h 11m
English
public class User implements Serializable{ private Long id; private String name; public User(long id, String name){ this.id = id; this.name = 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; } }
@Statelesspublic class UserBean { @Asynchronous public Future<User> getUser(){ long id = new Date().getTime(); User user = new User(id, "User " + id); return new AsyncResult(user); } @Asynchronous public void doSomeSlowStuff(User user){ try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException ex) { System.err.println(ex.getMessage()); ...Read now
Unlock full access