diff --git a/openfeature-provider-local/pom.xml b/openfeature-provider-local/pom.xml
index f8065a67..e18e4f6d 100644
--- a/openfeature-provider-local/pom.xml
+++ b/openfeature-provider-local/pom.xml
@@ -19,7 +19,7 @@
17
17
- v0.4.0
+ v0.5.0
diff --git a/openfeature-provider-local/src/main/java/com/spotify/confidence/WasmResolveApi.java b/openfeature-provider-local/src/main/java/com/spotify/confidence/WasmResolveApi.java
index 29686bac..0e20a3b0 100644
--- a/openfeature-provider-local/src/main/java/com/spotify/confidence/WasmResolveApi.java
+++ b/openfeature-provider-local/src/main/java/com/spotify/confidence/WasmResolveApi.java
@@ -40,6 +40,7 @@ class WasmResolveApi {
private final FunctionType HOST_FN_TYPE =
FunctionType.of(List.of(ValType.I32), List.of(ValType.I32));
private final Instance instance;
+ private boolean isConsumed = false;
// interop
private final ExportFunction wasmMsgAlloc;
@@ -127,6 +128,7 @@ public void close() {
final var respPtr = (int) wasmMsgFlushLogs.apply(reqPtr)[0];
final var request = consumeResponse(respPtr, WriteFlagLogsRequest::parseFrom);
writeFlagLogs.write(request);
+ isConsumed = true;
} finally {
wasmLock.readLock().unlock();
}
@@ -134,7 +136,7 @@ public void close() {
public ResolveWithStickyResponse resolveWithSticky(ResolveWithStickyRequest request)
throws IsClosedException {
- if (!wasmLock.writeLock().tryLock()) {
+ if (!wasmLock.writeLock().tryLock() || isConsumed) {
throw new IsClosedException();
}
try {