[ 
https://issues.apache.org/jira/browse/SCB-774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16559114#comment-16559114
 ] 

ASF GitHub Bot commented on SCB-774:
------------------------------------

wujimin closed pull request #836: [SCB-774] fix warn log caused by 
ReactiveExecutor
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/836
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/core/src/main/java/org/apache/servicecomb/core/executor/ReactiveExecutor.java 
b/core/src/main/java/org/apache/servicecomb/core/executor/ReactiveExecutor.java
index 54e164b0b..b062492de 100644
--- 
a/core/src/main/java/org/apache/servicecomb/core/executor/ReactiveExecutor.java
+++ 
b/core/src/main/java/org/apache/servicecomb/core/executor/ReactiveExecutor.java
@@ -17,15 +17,20 @@
 
 package org.apache.servicecomb.core.executor;
 
+import java.io.Closeable;
 import java.util.concurrent.Executor;
 
 /**
  * 用于在verticle中就地执行,不做多余的调度,这是性能最高的一种模型
  */
-public class ReactiveExecutor implements Executor {
+public class ReactiveExecutor implements Executor, Closeable {
 
   @Override
   public void execute(Runnable command) {
     command.run();
   }
+
+  @Override
+  public void close() {
+  }
 }
diff --git 
a/core/src/test/java/org/apache/servicecomb/core/provider/producer/TestProducerProviderManager.java
 
b/core/src/test/java/org/apache/servicecomb/core/provider/producer/TestProducerProviderManager.java
index f082240ce..0809f93fe 100644
--- 
a/core/src/test/java/org/apache/servicecomb/core/provider/producer/TestProducerProviderManager.java
+++ 
b/core/src/test/java/org/apache/servicecomb/core/provider/producer/TestProducerProviderManager.java
@@ -29,7 +29,6 @@
 import org.apache.servicecomb.core.definition.MicroserviceMetaManager;
 import org.apache.servicecomb.core.definition.OperationMeta;
 import org.apache.servicecomb.core.executor.FixedThreadExecutor;
-import org.apache.servicecomb.core.executor.ReactiveExecutor;
 import org.apache.servicecomb.foundation.test.scaffolding.log.LogCollector;
 import org.junit.Assert;
 import org.junit.Test;
@@ -102,7 +101,7 @@ void close() {
 
   @Test
   public void onBootEvent_close_unknown(@Mocked MicroserviceMeta 
microserviceMeta, @Mocked OperationMeta op1) {
-    Executor executor = new ReactiveExecutor();
+    Executor executor = new UnCloseableExecutor();
     new Expectations() {
       {
         microserviceMeta.getOperations();
@@ -121,8 +120,16 @@ public void onBootEvent_close_unknown(@Mocked 
MicroserviceMeta microserviceMeta,
     producerProviderManager.onBootEvent(event);
 
     Assert.assertEquals(
-        "Executor org.apache.servicecomb.core.executor.ReactiveExecutor do not 
support close or shutdown, it may block service shutdown.",
+        "Executor 
org.apache.servicecomb.core.provider.producer.TestProducerProviderManager$UnCloseableExecutor
 "
+            + "do not support close or shutdown, it may block service 
shutdown.",
         logCollector.getEvents().get(0).getMessage());
     logCollector.teardown();
   }
+
+  public static class UnCloseableExecutor implements Executor {
+    @Override
+    public void execute(Runnable command) {
+      command.run();
+    }
+  }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Unexpected warn log is printed while the service is exiting if there are 
> reactive operations
> --------------------------------------------------------------------------------------------
>
>                 Key: SCB-774
>                 URL: https://issues.apache.org/jira/browse/SCB-774
>             Project: Apache ServiceComb
>          Issue Type: Bug
>            Reporter: YaoHaishi
>            Assignee: YaoHaishi
>            Priority: Major
>             Fix For: java-chassis-1.1.0
>
>
> In reactive mode, the ReactiveExecutor is used as executor by default. And 
> the ReactiveExecutor is not a subclass of ExecutorService or Closeable, which 
> cause the ProducerProviderManager treats the ReactiveExecutor as a kind of 
> unclosable executor and prints the warn log.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to