diff --git a/prj/coherence-core/src/main/java/com/tangosol/net/cache/ContinuousQueryCache.java b/prj/coherence-core/src/main/java/com/tangosol/net/cache/ContinuousQueryCache.java index a8de7d9815d91..e194dd04639ee 100644 --- a/prj/coherence-core/src/main/java/com/tangosol/net/cache/ContinuousQueryCache.java +++ b/prj/coherence-core/src/main/java/com/tangosol/net/cache/ContinuousQueryCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. * * Licensed under the Universal Permissive License v 1.0 as shown at * https://oss.oracle.com/licenses/upl. @@ -638,7 +638,7 @@ protected void changeState(int nState) break; case STATE_CONFIGURING: - synchronized (this) + synchronized (m_nState) { int nStatePrev = m_nState; azzert(nStatePrev == STATE_DISCONNECTED || @@ -650,7 +650,7 @@ protected void changeState(int nState) break; case STATE_CONFIGURED: - synchronized (this) + synchronized (m_nState) { if (m_nState == STATE_CONFIGURING) { @@ -665,7 +665,7 @@ protected void changeState(int nState) break; case STATE_SYNCHRONIZED: - synchronized (this) + synchronized (m_nState) { if (m_nState == STATE_CONFIGURED) { @@ -1915,30 +1915,33 @@ protected boolean isEventDeferred(Object oKey) Map mapSyncReq = m_mapSyncReq; if (mapSyncReq != null) { - if (getState() <= STATE_CONFIGURING) + synchronized (m_nState) { - // handle a truncation event being received during configuration - // clear any currently pending events. - if (DeactivationListener.class.getName().equals(oKey)) + if (getState() <= STATE_CONFIGURING) { - mapSyncReq.clear(); + // handle a truncation event being received during configuration + // clear any currently pending events. + if (DeactivationListener.class.getName().equals(oKey)) + { + mapSyncReq.clear(); + } + else + { + // since the listeners are being configured and the local + // cache is being populated, assume that the event is + // being processed out-of-order and requires a subsequent + // synchronization of the corresponding value + mapSyncReq.put(oKey, null); + } + fDeferred = true; } else { - // since the listeners are being configured and the local - // cache is being populated, assume that the event is - // being processed out-of-order and requires a subsequent - // synchronization of the corresponding value - mapSyncReq.put(oKey, null); + // since an event has arrived after the configuration + // completed, the event automatically resolves the sync + // requirement + mapSyncReq.keySet().remove(oKey); } - fDeferred = true; - } - else - { - // since an event has arrived after the configuration - // completed, the event automatically resolves the sync - // requirement - mapSyncReq.keySet().remove(oKey); } } return fDeferred; @@ -3077,7 +3080,7 @@ protected static String getDefaultName(String sCacheName, Filter filter, ValueEx /** * State of the {@code ContinuousQueryCache}. One of the {@code STATE_*} enums. */ - protected volatile int m_nState; + protected volatile Integer m_nState; /** * While the {@code ContinuousQueryCache} is configuring or re-configuring its