Skip to content

Commit b8c43e7

Browse files
committed
migrate to vmlens 2.10
Signed-off-by: christian.lutnik <[email protected]>
1 parent 827c66f commit b8c43e7

File tree

3 files changed

+12
-27
lines changed

3 files changed

+12
-27
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
<dependency>
171171
<groupId>com.vmlens</groupId>
172172
<artifactId>api</artifactId>
173-
<version>1.2.3</version>
173+
<version>1.2.10</version>
174174
</dependency>
175175

176176
</dependencies>
@@ -307,7 +307,7 @@
307307
<plugin>
308308
<groupId>com.vmlens</groupId>
309309
<artifactId>vmlens-maven-plugin</artifactId>
310-
<version>1.2.3</version>
310+
<version>1.2.10</version>
311311
<executions>
312312
<execution>
313313
<id>test</id>

src/main/java/dev/openfeature/sdk/OpenFeatureClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import dev.openfeature.sdk.exceptions.OpenFeatureError;
88
import dev.openfeature.sdk.exceptions.ProviderNotReadyError;
99
import dev.openfeature.sdk.internal.ObjectUtils;
10+
import dev.openfeature.sdk.providers.memory.Flag;
11+
import dev.openfeature.sdk.providers.memory.InMemoryProvider;
1012
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
1113
import java.util.ArrayList;
1214
import java.util.Arrays;
@@ -16,6 +18,7 @@
1618
import java.util.Map;
1719
import java.util.Objects;
1820
import java.util.concurrent.ConcurrentLinkedQueue;
21+
import java.util.concurrent.atomic.AtomicInteger;
1922
import java.util.concurrent.atomic.AtomicReference;
2023
import java.util.function.Consumer;
2124
import lombok.Getter;
Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package dev.openfeature.sdk;
22

33
import com.vmlens.api.AllInterleavings;
4+
import com.vmlens.api.Runner;
45
import dev.openfeature.sdk.providers.memory.Flag;
56
import dev.openfeature.sdk.providers.memory.InMemoryProvider;
67
import java.util.HashMap;
@@ -10,14 +11,11 @@
1011
* Javadoc.
1112
*/
1213
public class VmLensTest {
13-
int jaVar = 0;
14-
15-
1614
public static void main(String[] args) throws InterruptedException {
1715
new VmLensTest().asomeMethod();
1816
}
1917

20-
private void asomeMethod() throws InterruptedException {
18+
public void asomeMethod() throws InterruptedException {
2119
var c = new AtomicInteger();
2220
final OpenFeatureAPI api = new OpenFeatureAPI();
2321

@@ -27,36 +25,20 @@ private void asomeMethod() throws InterruptedException {
2725
flags.put("c", Flag.builder().variant("a", "dfs").defaultVariant("a").build());
2826
flags.put("d", Flag.builder().variant("a", "asddd").defaultVariant("a").build());
2927
api.setProviderAndWait(new InMemoryProvider(flags));
28+
var client = api.getClient();
3029
try (AllInterleavings allInterleavings = new AllInterleavings("Concurrent evaluations and hook additions")) {
3130
while (allInterleavings.hasNext()) {
3231
c.incrementAndGet();
33-
var client = api.getClient();
34-
var firstReady = new Awaitable();
35-
Thread first = new Thread("test thread") {
36-
@Override
37-
public void run() {
38-
firstReady.wakeup();
39-
client.getStringValue("a", "a");
40-
//client.getStringValue("a", "a");
41-
}
42-
};
43-
44-
first.start();
45-
firstReady.await();
4632

47-
client.addHooks(new Hook() {});
48-
//client.addHooks(new Hook() {});
49-
50-
first.join();
33+
Runner.runParallel(
34+
() -> client.getStringValue("a", "a"),
35+
() -> client.addHooks(new Hook() {})
36+
);
5137
}
5238
}
5339

5440
api.shutdown();
5541

5642
System.out.println("c = " + c);
57-
System.out.println("jaVar = " + jaVar);
58-
59-
//Thread.sleep(5000);
60-
//System.exit(0);
6143
}
6244
}

0 commit comments

Comments
 (0)