wu-sheng commented on code in PR #13543:
URL: https://github.com/apache/skywalking/pull/13543#discussion_r2435159347


##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/worker/RemoteHandleWorker.java:
##########
@@ -18,13 +18,42 @@
 
 package org.apache.skywalking.oap.server.core.worker;
 
-import lombok.AllArgsConstructor;
 import lombok.Getter;
+import org.apache.skywalking.oap.server.core.UnexpectedException;
+import 
org.apache.skywalking.oap.server.core.analysis.meter.function.AcceptableValue;
+import org.apache.skywalking.oap.server.core.analysis.worker.MetricStreamKind;
 import org.apache.skywalking.oap.server.core.remote.data.StreamData;
 
-@AllArgsConstructor
 @Getter
 public class RemoteHandleWorker {
-    private AbstractWorker worker;
-    private Class<? extends StreamData> streamDataClass;
+    private final AbstractWorker worker;
+    private final MetricStreamKind kind;
+    private final Class<? extends StreamData> streamDataClass;
+
+    private AcceptableValue<?> meterPrototype;
+
+    public RemoteHandleWorker(AbstractWorker worker, MetricStreamKind kind,
+                              Class<? extends StreamData> streamDataClass) {
+        this.worker = worker;
+        this.kind = kind;
+        this.streamDataClass = streamDataClass;
+
+        if (MetricStreamKind.MAL == kind) {
+            try {
+                meterPrototype = (AcceptableValue<?>) 
streamDataClass.newInstance();
+            } catch (Exception e) {
+                throw new UnexpectedException("Can't create mal meter 
prototype with stream class" + streamDataClass);
+            }
+        }
+    }
+
+    public StreamData newStreamDataInstance() throws InstantiationException, 
IllegalAccessException {

Review Comment:
   Could you put comments here to describe why there are two ways to create an 
instance? Fundamentally, because of using different methods to initialize.



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