diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/RequestContext.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/RequestContext.java index c805d84593d61..71c52cd857fa0 100644 --- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/RequestContext.java +++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/RequestContext.java @@ -12,7 +12,6 @@ import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; import java.util.stream.Collectors; import javax.enterprise.context.BeforeDestroyed; @@ -168,7 +167,7 @@ public void destroy(ContextState state) { } if (state instanceof RequestContextState) { RequestContextState reqState = ((RequestContextState) state); - reqState.isValid.set(false); + reqState.isValid = false; synchronized (state) { Map, ContextInstanceHandle> map = ((RequestContextState) state).map; // Fire an event with qualifier @BeforeDestroyed(RequestScoped.class) if there are any observers for it @@ -228,11 +227,12 @@ private static Notifier createDestroyedNotifier() { static class RequestContextState implements ContextState { private final Map, ContextInstanceHandle> map; - private final AtomicBoolean isValid; + + private volatile boolean isValid; RequestContextState(ConcurrentMap, ContextInstanceHandle> value) { this.map = Objects.requireNonNull(value); - this.isValid = new AtomicBoolean(true); + this.isValid = true; } @Override @@ -243,7 +243,7 @@ public Map, Object> getContextualInstances() { @Override public boolean isValid() { - return isValid.get(); + return isValid; } }