rpuch commented on code in PR #4239:
URL: https://github.com/apache/ignite-3/pull/4239#discussion_r1723251000
##########
modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteServerImpl.java:
##########
@@ -82,10 +86,33 @@ public class IgniteServerImpl implements IgniteServer {
private final ClassLoader classLoader;
- private volatile @Nullable IgniteImpl instance;
+ private final Executor asyncContinuationExecutor;
+
+ /** Current Ignite instance. This field is not volatile to make hot path
accesses from IgniteReference and other references
+ * faster (they always happen under a read lock, which guarantees
visibility of changes to this field). So we access
+ * this field in this object under synchronization ({@link #igniteMonitor}
serves as the monitor).
+ */
+ private @Nullable IgniteImpl ignite;
Review Comment:
I tried to explain this in the javadoc. When executing user operations, we
always read this under a read lock, so we don't need it to be `volatile` for
visibility. If we make it `volatile`, we will add an extra volatile read, which
might hurt the performance.
--
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]