vernedeng commented on code in PR #8612:
URL: https://github.com/apache/inlong/pull/8612#discussion_r1281700974


##########
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/trace/WrapperOutputStream.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * 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.inlong.manager.web.trace;
+
+import org.apache.catalina.connector.CoyoteOutputStream;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+import javax.servlet.http.HttpServletResponse;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+public class WrapperOutputStream extends ServletOutputStream {
+
+    private OutputStream innerOut;
+    private HttpServletResponse response;
+
+    public WrapperOutputStream(OutputStream innerOut, HttpServletResponse 
response) {
+        super();
+        this.response = response;
+        this.innerOut = innerOut;
+    }
+
+    @Override
+    public boolean isReady() {
+        if (response == null) {
+            return false;
+        }
+        try {
+            return response.getOutputStream().isReady();
+        } catch (IOException e) {
+            e.printStackTrace();

Review Comment:
   ```suggestion
           LOG.err("got exception when check if  the output stream is ready", e)
   ```



##########
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/trace/WrapperOutputStream.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * 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.inlong.manager.web.trace;
+
+import org.apache.catalina.connector.CoyoteOutputStream;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+import javax.servlet.http.HttpServletResponse;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+public class WrapperOutputStream extends ServletOutputStream {
+
+    private OutputStream innerOut;
+    private HttpServletResponse response;
+
+    public WrapperOutputStream(OutputStream innerOut, HttpServletResponse 
response) {
+        super();
+        this.response = response;
+        this.innerOut = innerOut;
+    }
+
+    @Override
+    public boolean isReady() {
+        if (response == null) {
+            return false;
+        }
+        try {
+            return response.getOutputStream().isReady();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return false;
+    }
+
+    @Override
+    public void setWriteListener(WriteListener listener) {
+        if (response != null) {
+            try {
+                ((CoyoteOutputStream) 
response.getOutputStream()).setWriteListener(listener);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    @Override
+    public void write(int b) throws IOException {

Review Comment:
   **_b_** is not a readable name



##########
pom.xml:
##########
@@ -205,6 +205,14 @@
 
     <dependencyManagement>
         <dependencies>
+            <!--opentelemetry-->
+            <dependency>
+                <groupId>io.opentelemetry</groupId>
+                <artifactId>opentelemetry-bom</artifactId>
+                <version>1.24.0</version>

Review Comment:
   Please define the version as a reference



##########
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/trace/WrapperOutputStream.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * 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.inlong.manager.web.trace;
+
+import org.apache.catalina.connector.CoyoteOutputStream;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+import javax.servlet.http.HttpServletResponse;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+public class WrapperOutputStream extends ServletOutputStream {
+
+    private OutputStream innerOut;
+    private HttpServletResponse response;
+
+    public WrapperOutputStream(OutputStream innerOut, HttpServletResponse 
response) {
+        super();
+        this.response = response;
+        this.innerOut = innerOut;
+    }
+
+    @Override
+    public boolean isReady() {
+        if (response == null) {
+            return false;
+        }
+        try {
+            return response.getOutputStream().isReady();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return false;
+    }
+
+    @Override
+    public void setWriteListener(WriteListener listener) {
+        if (response != null) {
+            try {
+                ((CoyoteOutputStream) 
response.getOutputStream()).setWriteListener(listener);
+            } catch (IOException e) {
+                e.printStackTrace();

Review Comment:
   ditto



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