You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/07/27 11:10:32 UTC

[GitHub] [shardingsphere] sora91s opened a new pull request, #19608: feature -- support 'show processlist' in standalone mode

sora91s opened a new pull request, #19608:
URL: https://github.com/apache/shardingsphere/pull/19608

   Fixes #19606.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sora91s closed pull request #19608: feature -- support 'show processlist' in standalone mode

Posted by GitBox <gi...@apache.org>.
sora91s closed pull request #19608: feature -- support 'show processlist' in standalone mode
URL: https://github.com/apache/shardingsphere/pull/19608


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] tuichenchuxin commented on a diff in pull request #19608: feature -- support 'show processlist' in standalone mode

Posted by GitBox <gi...@apache.org>.
tuichenchuxin commented on code in PR #19608:
URL: https://github.com/apache/shardingsphere/pull/19608#discussion_r931725144


##########
shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/process/subscriber/ProcessRegistrySubscriber.java:
##########
@@ -50,23 +54,45 @@
  */
 public final class ProcessRegistrySubscriber {
     
-    private final ClusterPersistRepository repository;
+    private final PersistRepository repository;
     
     private final EventBusContext eventBusContext;
     
-    public ProcessRegistrySubscriber(final ClusterPersistRepository repository, final EventBusContext eventBusContext) {
+    public ProcessRegistrySubscriber(final PersistRepository repository, final EventBusContext eventBusContext) {
         this.repository = repository;
         this.eventBusContext = eventBusContext;
         eventBusContext.register(this);
     }
     
+    public ProcessRegistrySubscriber(final EventBusContext eventBusContext) {
+        this.eventBusContext = eventBusContext;
+        repository = null;
+        eventBusContext.register(this);
+    }
+    
     /**
      * Load show process list data.
      *
      * @param event get children request event.
      */
     @Subscribe
     public void loadShowProcessListData(final ShowProcessListRequestEvent event) {
+        if (repository != null) {

Review Comment:
   ```suggestion
           if (null != repository) {
   ```



##########
shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/process/subscriber/ProcessRegistrySubscriber.java:
##########
@@ -50,23 +54,45 @@
  */
 public final class ProcessRegistrySubscriber {
     
-    private final ClusterPersistRepository repository;
+    private final PersistRepository repository;
     
     private final EventBusContext eventBusContext;
     
-    public ProcessRegistrySubscriber(final ClusterPersistRepository repository, final EventBusContext eventBusContext) {
+    public ProcessRegistrySubscriber(final PersistRepository repository, final EventBusContext eventBusContext) {
         this.repository = repository;
         this.eventBusContext = eventBusContext;
         eventBusContext.register(this);
     }
     
+    public ProcessRegistrySubscriber(final EventBusContext eventBusContext) {
+        this.eventBusContext = eventBusContext;
+        repository = null;
+        eventBusContext.register(this);
+    }
+    
     /**
      * Load show process list data.
      *
      * @param event get children request event.
      */
     @Subscribe
     public void loadShowProcessListData(final ShowProcessListRequestEvent event) {
+        if (repository != null) {
+            loadClusterShowProcessListData();
+        } else {
+            loadStandaloneShowProcessListData();
+        }
+    }
+    
+    private void loadStandaloneShowProcessListData() {
+        BatchYamlExecuteProcessContext batchYamlExecuteProcessContext = new BatchYamlExecuteProcessContext(new ArrayList<>(
+                ShowProcessListManager.getInstance().getProcessContextMap().values()));
+        eventBusContext.post(new ShowProcessListResponseEvent(batchYamlExecuteProcessContext.getContexts().isEmpty()
+                ? null

Review Comment:
   ```suggestion
                   ? Collections.emptyList();
   ```



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org