walterddr commented on code in PR #9484:
URL: https://github.com/apache/pinot/pull/9484#discussion_r998760609


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/mailbox/InMemoryMailboxService.java:
##########
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.query.mailbox;
+
+import com.google.common.base.Preconditions;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.pinot.query.runtime.blocks.TransferableBlock;
+
+
+public class InMemoryMailboxService implements 
MailboxService<TransferableBlock> {
+  // channel manager
+  private final String _hostname;
+  private final int _mailboxPort;
+  static final int DEFAULT_CHANNEL_CAPACITY = 5;
+  // TODO: This should come from a config and should be consistent with the 
timeout for GrpcMailboxService
+  static final int DEFAULT_CHANNEL_TIMEOUT_SECONDS = 120;
+
+  // maintaining a list of registered mailboxes.
+  private final ConcurrentHashMap<String, ReceivingMailbox<TransferableBlock>> 
_receivingMailboxMap =
+      new ConcurrentHashMap<>();
+  private final ConcurrentHashMap<String, SendingMailbox<TransferableBlock>> 
_sendingMailboxMap =
+      new ConcurrentHashMap<>();
+  private final ConcurrentHashMap<String, 
ArrayBlockingQueue<TransferableBlock>> _channelMap =
+      new ConcurrentHashMap<>();

Review Comment:
   i think this was my original split in grpc mailbox ( this was necessary as 
the channels and mailbox are separately managed) 
   but in this case all 3 are guaranteed 1-1 mapping b/c they are all in the 
same JVM
   
   I am ok with both approaches since 
   - grouping them make more clear code smell, we can precisely managed them 
together because it is a special property of the in-mem mailbox
   - separating them makes logical sense as separation of concern (e.g. the 
sender normally won't have access to the receiving side info, this just happen 
to be the case for in-mem mailbox)
   
   



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

Reply via email to