sanpwc commented on a change in pull request #348:
URL: https://github.com/apache/ignite-3/pull/348#discussion_r714959668



##########
File path: 
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java
##########
@@ -310,4 +344,117 @@ private int partId(BinaryRow row) {
                     return list;
                 });
     }
+
+    /** Parition scan publisher. */
+    private class PartitionScanPublisher implements Publisher<BinaryRow> {
+        /** List of subscriptions. */
+        private final List<PartitionScanSubscription> subscriptions;
+
+        /** {@link Publisher<BinaryRow>} that relatively notifies about 
partition rows.  */
+        private final RaftGroupService raftGrpSvc;
+
+        /**
+         * The constructor.
+         *
+         * @param raftGrpSvc {@link Publisher<BinaryRow>} that relatively 
notifies about partition rows.
+         */
+        PartitionScanPublisher(RaftGroupService raftGrpSvc) {
+            this.subscriptions = Collections.synchronizedList(new 
ArrayList<>());
+            this.raftGrpSvc = raftGrpSvc;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void subscribe(Subscriber<? super BinaryRow> 
subscriber) {
+            PartitionScanSubscription subscription = new 
PartitionScanSubscription(subscriber);
+
+            subscriptions.add(subscription);

Review comment:
       `one subscriber per publisher` is actually a good idea not only for 
first iteration, [flow 
documentation](https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.html)
 claims that
   `it is better to instead define multiple Subscribers, each with its own 
Subscription`
   
   ` Because Subscriber method invocations for a given Flow.Subscription are 
strictly ordered, there is no need for these methods to use locks or volatiles 
unless a Subscriber maintains multiple Subscriptions (in which case it is 
better to instead define multiple Subscribers, each with its own Subscription). 
`
   
   Fixed.




-- 
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]


Reply via email to