57361
|
1 |
package jdk.jfr.consumer;
|
|
2 |
|
|
3 |
import jdk.jfr.internal.Type;
|
|
4 |
|
|
5 |
final class ConstantLookup {
|
|
6 |
|
|
7 |
private final Type type;
|
|
8 |
private ConstantMap current;
|
|
9 |
private ConstantMap previous = ConstantMap.EMPTY;
|
|
10 |
|
|
11 |
ConstantLookup(ConstantMap current, Type type) {
|
|
12 |
this.current = current;
|
|
13 |
this.type = type;
|
|
14 |
}
|
|
15 |
|
|
16 |
public Type getType() {
|
|
17 |
return type;
|
|
18 |
}
|
|
19 |
|
|
20 |
public ConstantMap getLatestPool() {
|
|
21 |
return current;
|
|
22 |
}
|
|
23 |
|
|
24 |
public void newPool() {
|
57467
|
25 |
previous = current;
|
57361
|
26 |
current = new ConstantMap(current.factory, current.name);
|
|
27 |
// previous = new ConstantMap(); // disable cache
|
|
28 |
}
|
|
29 |
|
|
30 |
public Object getPreviousResolved(long key) {
|
|
31 |
return previous.getResolved(key);
|
|
32 |
}
|
|
33 |
|
|
34 |
public Object getCurrentResolved(long key) {
|
|
35 |
return current.getResolved(key);
|
|
36 |
}
|
|
37 |
|
|
38 |
public Object getCurrent(long key) {
|
|
39 |
return current.get(key);
|
|
40 |
}
|
|
41 |
}
|