-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployeeTaskTwo.java
More file actions
54 lines (41 loc) · 1.3 KB
/
EmployeeTaskTwo.java
File metadata and controls
54 lines (41 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package org.javaee7.chapter11;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.Callable;
import javax.enterprise.concurrent.ManagedTask;
import javax.enterprise.concurrent.ManagedTaskListener;
/**
*
* @author Juneau
*/
public class EmployeeTaskTwo implements Callable<EmployeeInfo>, ManagedTask {
// The ID of the request to report on demand.
BigDecimal employeeId;
EmployeeInfo employeeInfo;
Map<String, String> execProps;
public EmployeeTaskTwo(BigDecimal id) {
this.employeeId = id;
execProps = new HashMap<>();
execProps.put(ManagedTask.IDENTITY_NAME, getIdentityName());
}
public EmployeeInfo call() {
// Find the entity bean and return it to the client.
return employeeInfo;
}
public String getIdentityName() {
return "EmployeeTask: AuthorID=" + employeeId;
}
public Map<String, String> getExecutionProperties() {
return execProps;
}
public String getIdentityDescription(Locale locale) {
// Use a resource bundle...
return "EmployeeTask asynchronous EJB invoker";
}
@Override
public ManagedTaskListener getManagedTaskListener() {
return new CustomManagedTaskListener();
}
}