6
6
import static dev .openfeature .sdk .testutils .TestFlagsUtils .OBJECT_FLAG_KEY ;
7
7
import static dev .openfeature .sdk .testutils .TestFlagsUtils .STRING_FLAG_KEY ;
8
8
9
+ import dev .openfeature .sdk .BooleanHook ;
9
10
import dev .openfeature .sdk .Client ;
11
+ import dev .openfeature .sdk .DoubleHook ;
10
12
import dev .openfeature .sdk .EvaluationContext ;
11
- import dev .openfeature .sdk .Hook ;
12
13
import dev .openfeature .sdk .HookContext ;
13
14
import dev .openfeature .sdk .ImmutableContext ;
14
15
import dev .openfeature .sdk .ImmutableStructure ;
16
+ import dev .openfeature .sdk .IntegerHook ;
15
17
import dev .openfeature .sdk .NoOpProvider ;
18
+ import dev .openfeature .sdk .ObjectHook ;
16
19
import dev .openfeature .sdk .OpenFeatureAPI ;
20
+ import dev .openfeature .sdk .StringHook ;
17
21
import dev .openfeature .sdk .Value ;
18
22
import java .util .HashMap ;
19
23
import java .util .Map ;
25
29
26
30
/**
27
31
* Runs a large volume of flag evaluations on a VM with 1G memory and GC
28
- * completely disabled so we can take a heap-dump.
32
+ * completely disabled, so we can take a heap-dump.
29
33
*/
30
34
public class AllocationBenchmark {
31
35
@@ -48,31 +52,31 @@ public void run() {
48
52
Map <String , Value > clientAttrs = new HashMap <>();
49
53
clientAttrs .put ("client" , new Value (2 ));
50
54
client .setEvaluationContext (new ImmutableContext (clientAttrs ));
51
- client .addHooks (new Hook < Object > () {
55
+ client .addHooks (new ObjectHook () {
52
56
@ Override
53
57
public Optional <EvaluationContext > before (HookContext <Object > ctx , Map <String , Object > hints ) {
54
58
return Optional .ofNullable (new ImmutableContext ());
55
59
}
56
60
});
57
- client .addHooks (new Hook < String > () {
61
+ client .addHooks (new StringHook () {
58
62
@ Override
59
63
public Optional <EvaluationContext > before (HookContext <String > ctx , Map <String , Object > hints ) {
60
64
return Optional .ofNullable (new ImmutableContext ());
61
65
}
62
66
});
63
- client .addHooks (new Hook < Boolean > () {
67
+ client .addHooks (new BooleanHook () {
64
68
@ Override
65
69
public Optional <EvaluationContext > before (HookContext <Boolean > ctx , Map <String , Object > hints ) {
66
70
return Optional .ofNullable (new ImmutableContext ());
67
71
}
68
72
});
69
- client .addHooks (new Hook < Integer > () {
73
+ client .addHooks (new IntegerHook () {
70
74
@ Override
71
75
public Optional <EvaluationContext > before (HookContext <Integer > ctx , Map <String , Object > hints ) {
72
76
return Optional .ofNullable (new ImmutableContext ());
73
77
}
74
78
});
75
- client .addHooks (new Hook < Double > () {
79
+ client .addHooks (new DoubleHook () {
76
80
@ Override
77
81
public Optional <EvaluationContext > before (HookContext <Double > ctx , Map <String , Object > hints ) {
78
82
return Optional .ofNullable (new ImmutableContext ());
0 commit comments