wuqke commented on issue #2219: Dubbo Server 老是会调用DubboShutdownHook 自动关闭
URL: 
https://github.com/apache/incubator-dubbo/issues/2219#issuecomment-412095884
 
 
   @kimmking  yes,it crashed on MacOS either. The logs shows below:
    
   The version of my macOS is  Sierra10.12 (16A323).
   
   ```
   //crashDown demo crash logs:
   2018-08-09 14:44:08.381 [main] INFO  com.alibaba.dubbo.container.Main -  
[DUBBO] Dubbo SpringContainer started!, dubbo version: 2.6.2, current host: 
172.20.10.5
   2018-08-09 14:45:09.573 [DubboShutdownHook] INFO  
com.alibaba.dubbo.config.AbstractConfig -  [DUBBO] Run shutdown hook now., 
dubbo version: 2.6.2, current host: 172.20.10.5
   2018-08-09 14:45:09.574 [DubboShutdownHook] INFO  
c.a.dubbo.registry.support.AbstractRegistryFactory -  [DUBBO] Close all 
registries 
[zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=crashdown_provider&dubbo=2.6.2&interface=com.alibaba.dubbo.registry.RegistryService&logger=slf4j&pid=3404&timestamp=1533797047515],
 dubbo version: 2.6.2, current host: 172.20.10.5
   ```
   Otherwise,I folllow the method that @playaround88 provided,which was 
blocking the main thread go dead.And it truely works on linux and macOS.
   
   
   ```
   //DubboServer main method
   try {
               logger.info("provider start now!");
               Main.main(args);
           } catch (Exception e) {
               e.printStackTrace();
               logger.error(e.getMessage());
           } finally {
               while (true) {
                   try {
                     //prevent the main thread to die.
                     Thread.sleep(Long.MAX_VALUE);
   //                    Thread.currentThread().join();
                   } catch (InterruptedException e) {
                       logger.error("io crash accidently", e);
                   }
               }
   
           }
   //it is running since 
   2018-08-09 22:28:42.963 [main] INFO  com.alibaba.dubbo.container.Main -  
[DUBBO] Dubbo SpringContainer started!, dubbo version: 2.6.2, current host: 
172.27.0.5
   
   ```

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to