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

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

liubao68 closed pull request #1023: [SCB-1066] when start error, destroy method 
may throw an exception le…
URL: https://github.com/apache/servicecomb-java-chassis/pull/1023
 
 
   

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/SCBEngine.java 
b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
index f364d1c6f..7cdb51e7b 100644
--- a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
+++ b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
@@ -211,7 +211,11 @@ public synchronized void init() {
       } catch (TimeoutException e) {
         LOGGER.warn("{}", e.getMessage());
       } catch (Throwable e) {
-        destroy();
+        try {
+          destroy();
+        } catch (Exception exception) {
+          LOGGER.info("destroy has some error.", exception);
+        }
         status = SCBStatus.FAILED;
         throw new IllegalStateException("ServiceComb init failed.", e);
       }
diff --git 
a/core/src/main/java/org/apache/servicecomb/core/provider/producer/ProducerProviderManager.java
 
b/core/src/main/java/org/apache/servicecomb/core/provider/producer/ProducerProviderManager.java
index 12a555b1a..737792a16 100644
--- 
a/core/src/main/java/org/apache/servicecomb/core/provider/producer/ProducerProviderManager.java
+++ 
b/core/src/main/java/org/apache/servicecomb/core/provider/producer/ProducerProviderManager.java
@@ -63,7 +63,9 @@ public void onBootEvent(BootEvent event) {
     if (!EventType.AFTER_CLOSE.equals(event.getEventType())) {
       return;
     }
-
+    if (microserviceMeta == null) {
+      return;
+    }
     for (OperationMeta operationMeta : microserviceMeta.getOperations()) {
       if (ExecutorService.class.isInstance(operationMeta.getExecutor())) {
         ((ExecutorService) operationMeta.getExecutor()).shutdown();
diff --git 
a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/LocalServiceRegistryClientImpl.java
 
b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/LocalServiceRegistryClientImpl.java
index b0d29ee8e..201ceb5f5 100644
--- 
a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/LocalServiceRegistryClientImpl.java
+++ 
b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/LocalServiceRegistryClientImpl.java
@@ -219,6 +219,9 @@ public String 
registerMicroserviceInstance(MicroserviceInstance instance) {
 
   @Override
   public boolean unregisterMicroserviceInstance(String microserviceId, String 
microserviceInstanceId) {
+    if (microserviceId == null) {
+      return true;
+    }
     Map<String, MicroserviceInstance> instanceMap = 
microserviceInstanceMap.get(microserviceId);
     if (instanceMap != null) {
       instanceMap.remove(microserviceInstanceId);


 

----------------------------------------------------------------
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:
us...@infra.apache.org


> when start error, destroy method may throw an exception lead to origin 
> exception losed
> --------------------------------------------------------------------------------------
>
>                 Key: SCB-1066
>                 URL: https://issues.apache.org/jira/browse/SCB-1066
>             Project: Apache ServiceComb
>          Issue Type: Bug
>          Components: Java-Chassis
>            Reporter: jeho0815
>            Assignee: jeho0815
>            Priority: Major
>         Attachments: image-2018-12-04-21-25-08-309.png
>
>
>  
> 1、when operationid repead, ProducerProviderManager shutdown error with a NPE
> 2、using LocalServiceRegistryClientImpl 
> !image-2018-12-04-21-25-08-309.png!
>  



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

Reply via email to