You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/01/16 01:45:43 UTC

[GitHub] [skywalking] mrproliu commented on a change in pull request #4220: sniffer processing profile task and report status and snapshot

mrproliu commented on a change in pull request #4220: sniffer processing profile task and report status and snapshot
URL: https://github.com/apache/skywalking/pull/4220#discussion_r367195064
 
 

 ##########
 File path: apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/profile/ProfileThread.java
 ##########
 @@ -0,0 +1,111 @@
+/*
+ * 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.skywalking.apm.agent.core.profile;
+
+import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
+import org.apache.skywalking.apm.agent.core.logging.api.ILog;
+import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
+
+/**
+ * Profile task process thread, dump segment executing thread stack.
+ *
+ * @author MrPro
+ */
+public class ProfileThread implements Runnable {
+
+    private static final ILog logger = LogManager.getLogger(ProfileThread.class);
+
+    // profiling task context
+    private final ProfileTaskExecutionContext taskExecutionContext;
+
+    private final ProfileTaskExecutionService profileTaskExecutionService;
+    private final ProfileTaskChannelService profileTaskChannelService;
+
+    public ProfileThread(ProfileTaskExecutionContext taskExecutionContext) {
+        this.taskExecutionContext = taskExecutionContext;
+        profileTaskExecutionService = ServiceManager.INSTANCE.findService(ProfileTaskExecutionService.class);
+        profileTaskChannelService = ServiceManager.INSTANCE.findService(ProfileTaskChannelService.class);
+    }
+
+    @Override
+    public void run() {
+
+        try {
+            profiling(taskExecutionContext);
+        } catch (InterruptedException e) {
+            // ignore interrupted
+            // means current task has stopped
 
 Review comment:
   Yes, I think it will only end when other threads notify him, unless he actively raises an exception.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services