imbajin commented on code in PR #2620:
URL:
https://github.com/apache/incubator-hugegraph/pull/2620#discussion_r1712520066
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStoreProvider.java:
##########
@@ -67,7 +70,10 @@ protected final void checkOpened() {
@Override
public void listen(EventListener listener) {
- this.storeEventHub.listen(EventHub.ANY_EVENT, listener);
+ if (schemaCacheClearListened.compareAndSet(false, true) ||
+ vertexEdgeCacheClearListened.compareAndSet(false, true)) {
Review Comment:
Some question:
- we define 2 automic_param boolean A & B and try to set them to `true`,
when to reset it?
- why we need 2 flag to mark it? (in this context)
- since **assignment operations** (`=`) for **primitive types** are atomic
by default(64bit), it seems that we only need to use a `volatile` boolean flag
to achieve the desired effect?
@Pengzna @VGalaxies
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStoreProvider.java:
##########
@@ -67,7 +70,10 @@ protected final void checkOpened() {
@Override
public void listen(EventListener listener) {
- this.storeEventHub.listen(EventHub.ANY_EVENT, listener);
+ if (schemaCacheClearListened.compareAndSet(false, true) ||
+ vertexEdgeCacheClearListened.compareAndSet(false, true)) {
Review Comment:
Some questions:
- we define 2 automic_param boolean A & B and try to set them to `true`,
when to reset it?
- why we need 2 flag to mark it? (in this context)
- since **assignment operations** (`=`) for **primitive types** are atomic
by default(64bit), it seems that we only need to use a `volatile` boolean flag
to achieve the desired effect?
@Pengzna @VGalaxies
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]