gortiz commented on code in PR #17674:
URL: https://github.com/apache/pinot/pull/17674#discussion_r2821584319


##########
pinot-core/src/main/java/org/apache/pinot/core/transport/NettyInspector.java:
##########
@@ -0,0 +1,158 @@
+/**
+ * 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.core.transport;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.function.Function;
+import javax.annotation.Nullable;
+import org.apache.pinot.common.metrics.AbstractMetrics;
+import org.apache.pinot.spi.utils.DataSizeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/// Utility class to inspect Netty constants and log their values, with the 
ability to check for specific conditions
+/// and log warnings if they are not met.
+public class NettyInspector {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(NettyInspector.class);
+  /// We use a CopyOnWriteArrayList to allow dynamic addition of checks at 
runtime, if needed.
+  public static final CopyOnWriteArrayList<Check> CHECKS;
+  /// We use a CopyOnWriteArrayList to allow dynamic addition of Netty 
instances at runtime,
+  /// if needed (e.g. if we want to support other shaded versions of Netty).
+  public static final CopyOnWriteArrayList<NettyInstance> KNOWN_INSTANCES;

Review Comment:
   Third-party distributions may include their own Netty copies as well. In 
StarTree, we don't do that, but I don't know about other distributors. A 
copy-on-write structure is thread-safe and very cheap to read (it incurs a cost 
when writing). Given we mostly only going to use it to read from it (as you 
said, probably nobody is going to modify it later), I think this is the best 
solution for our use case.  



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