[jira] [Commented] (SCB-548) Support Gracefully Shutdown
[ https://issues.apache.org/jira/browse/SCB-548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16472877#comment-16472877 ] ASF GitHub Bot commented on SCB-548: wujimin commented on issue #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#issuecomment-388522879 and CI failed, it's about trace, i can find what happened, it seems that did not print error test case name? 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 > Support Gracefully Shutdown > --- > > Key: SCB-548 > URL: https://issues.apache.org/jira/browse/SCB-548 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Java-Chassis >Affects Versions: java-chassis-1.0.0-m2 >Reporter: yangyongzheng >Assignee: yangyongzheng >Priority: Major > > We did not implement gracefully shutdown yet: > ```java > // 当程序退出时,进行相关清理,注意:kill -9 {pid}下无效 > // 1. 去注册实例信息 > // TODO 服务优雅退出 > if (applicationContext instanceof AbstractApplicationContext) { > ((AbstractApplicationContext) > applicationContext).registerShutdownHook(); > } > ``` > > And had got an issue : > https://github.com/apache/incubator-servicecomb-java-chassis/issues/685 from > user. > So it's time we must do it and remove this TODO -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-548) Support Gracefully Shutdown
[ https://issues.apache.org/jira/browse/SCB-548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16472876#comment-16472876 ] ASF GitHub Bot commented on SCB-548: wujimin commented on issue #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#issuecomment-388522824 ShutdownHookHandler is not so good, sometimes will block shutdown process cause of wrong statistics, must depend on timeout to make shutdown process continue. we should: 1.prevent create new consumer invocation 2.prevent other find me 3.make accurate statistics 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 > Support Gracefully Shutdown > --- > > Key: SCB-548 > URL: https://issues.apache.org/jira/browse/SCB-548 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Java-Chassis >Affects Versions: java-chassis-1.0.0-m2 >Reporter: yangyongzheng >Assignee: yangyongzheng >Priority: Major > > We did not implement gracefully shutdown yet: > ```java > // 当程序退出时,进行相关清理,注意:kill -9 {pid}下无效 > // 1. 去注册实例信息 > // TODO 服务优雅退出 > if (applicationContext instanceof AbstractApplicationContext) { > ((AbstractApplicationContext) > applicationContext).registerShutdownHook(); > } > ``` > > And had got an issue : > https://github.com/apache/incubator-servicecomb-java-chassis/issues/685 from > user. > So it's time we must do it and remove this TODO -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-532) support recursive dependence
[ https://issues.apache.org/jira/browse/SCB-532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16472875#comment-16472875 ] ASF GitHub Bot commented on SCB-532: wujimin commented on a change in pull request #699: [SCB-532] Support recursive dependency URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/699#discussion_r187761407 ## File path: common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/JavassistUtils.java ## @@ -185,10 +185,47 @@ private static void addEnumValuesMethod(CtClass ctClass, List values) th } } - LOGGER.info("generate {} in classLoader {}.", config.getClassName(), classLoader); - return ctClass.toClass(classLoader, null); + LOGGER.info("create CtClass {} in classLoader {}.", config.getClassName(), classLoader); + return ctClass; +} catch (Throwable e) { + throw new IllegalStateException( + String.format("Failed to create CtClass %s in classLoader %s.", config.getClassName(), + classLoader), e); +} + } + + public static Class createClass(ClassLoader classLoader, ClassConfig config) { +if (classLoader == null) { Review comment: i have test for this because already throw exception with error context, invoker already print the exception if print in this place, then will print multi times. so i think it's better not log here. what's your suggestion? 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 > support recursive dependence > > > Key: SCB-532 > URL: https://issues.apache.org/jira/browse/SCB-532 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: wujimin >Assignee: wujimin >Priority: Major > Fix For: java-chassis-1.0.0-m2 > > > {code:java} > 1.class A{ > A a; > } > 2.class A{ > B b; > } > class B{ > A a; > }{code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (SCB-576) javassist License file need to be updated
Willem Jiang created SCB-576: Summary: javassist License file need to be updated Key: SCB-576 URL: https://issues.apache.org/jira/browse/SCB-576 Project: Apache ServiceComb Issue Type: Improvement Components: Java-Chassis Reporter: Willem Jiang Since Java Chassis has long history, even the License is changed into ASL, the license file not the normal one we use. So we still need to add the License file for it. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-532) support recursive dependence
[ https://issues.apache.org/jira/browse/SCB-532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16472812#comment-16472812 ] ASF GitHub Bot commented on SCB-532: WillemJiang commented on a change in pull request #699: [SCB-532] Support recursive dependency URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/699#discussion_r187755431 ## File path: common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/JavassistUtils.java ## @@ -185,10 +185,47 @@ private static void addEnumValuesMethod(CtClass ctClass, List values) th } } - LOGGER.info("generate {} in classLoader {}.", config.getClassName(), classLoader); - return ctClass.toClass(classLoader, null); + LOGGER.info("create CtClass {} in classLoader {}.", config.getClassName(), classLoader); + return ctClass; +} catch (Throwable e) { + throw new IllegalStateException( + String.format("Failed to create CtClass %s in classLoader %s.", config.getClassName(), + classLoader), e); +} + } + + public static Class createClass(ClassLoader classLoader, ClassConfig config) { +if (classLoader == null) { + classLoader = Thread.currentThread().getContextClassLoader(); +} + +CtClass ctClass = createCtClass(classLoader, config); +return createClass(classLoader, ctClass); + } + + public static Class createClass(ClassLoader classLoader, CtClass ctClass) { +if (classLoader == null) { + classLoader = Thread.currentThread().getContextClassLoader(); Review comment: Same issue here. 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 > support recursive dependence > > > Key: SCB-532 > URL: https://issues.apache.org/jira/browse/SCB-532 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: wujimin >Assignee: wujimin >Priority: Major > Fix For: java-chassis-1.0.0-m2 > > > {code:java} > 1.class A{ > A a; > } > 2.class A{ > B b; > } > class B{ > A a; > }{code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-532) support recursive dependence
[ https://issues.apache.org/jira/browse/SCB-532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16472813#comment-16472813 ] ASF GitHub Bot commented on SCB-532: WillemJiang commented on a change in pull request #699: [SCB-532] Support recursive dependency URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/699#discussion_r187755264 ## File path: common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/JavassistUtils.java ## @@ -185,10 +185,47 @@ private static void addEnumValuesMethod(CtClass ctClass, List values) th } } - LOGGER.info("generate {} in classLoader {}.", config.getClassName(), classLoader); - return ctClass.toClass(classLoader, null); + LOGGER.info("create CtClass {} in classLoader {}.", config.getClassName(), classLoader); + return ctClass; +} catch (Throwable e) { + throw new IllegalStateException( + String.format("Failed to create CtClass %s in classLoader %s.", config.getClassName(), + classLoader), e); +} + } + + public static Class createClass(ClassLoader classLoader, ClassConfig config) { +if (classLoader == null) { Review comment: It's better to add a log here for tracking the classloader issue. 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 > support recursive dependence > > > Key: SCB-532 > URL: https://issues.apache.org/jira/browse/SCB-532 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: wujimin >Assignee: wujimin >Priority: Major > Fix For: java-chassis-1.0.0-m2 > > > {code:java} > 1.class A{ > A a; > } > 2.class A{ > B b; > } > class B{ > A a; > }{code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-548) Support Gracefully Shutdown
[ https://issues.apache.org/jira/browse/SCB-548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16471665#comment-16471665 ] ASF GitHub Bot commented on SCB-548: zhengyangyong commented on issue #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#issuecomment-388301667 improve gracefully shutdown process order ```java private void gracefullyShutdown() { //Step 1: notify all component stop invoke via BEFORE_CLOSE Event triggerEvent(EventType.BEFORE_CLOSE); //Step 2: Unregister microservice instance from Service Center and close vertx RegistryUtils.destroy(); VertxUtils.closeVertxByName("registry"); //Step 3: wait all invocation finished try { ShutdownHookHandler.INSTANCE.ALL_INVOCATION_FINISHED.acquire(); LOGGER.warn("all invocation finished"); } catch (InterruptedException e) { LOGGER.error("invocation finished semaphore interrupted", e); } //Step 4: Stop vertx to prevent blocking exit VertxUtils.closeVertxByName("config-center"); VertxUtils.closeVertxByName("transport"); //Step 5: notify all component do clean works via AFTER_CLOSE Event triggerEvent(EventType.AFTER_CLOSE); } ``` 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 > Support Gracefully Shutdown > --- > > Key: SCB-548 > URL: https://issues.apache.org/jira/browse/SCB-548 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Java-Chassis >Affects Versions: java-chassis-1.0.0-m2 >Reporter: yangyongzheng >Assignee: yangyongzheng >Priority: Major > > We did not implement gracefully shutdown yet: > ```java > // 当程序退出时,进行相关清理,注意:kill -9 {pid}下无效 > // 1. 去注册实例信息 > // TODO 服务优雅退出 > if (applicationContext instanceof AbstractApplicationContext) { > ((AbstractApplicationContext) > applicationContext).registerShutdownHook(); > } > ``` > > And had got an issue : > https://github.com/apache/incubator-servicecomb-java-chassis/issues/685 from > user. > So it's time we must do it and remove this TODO -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-548) Support Gracefully Shutdown
[ https://issues.apache.org/jira/browse/SCB-548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16471651#comment-16471651 ] ASF GitHub Bot commented on SCB-548: coveralls commented on issue #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#issuecomment-387664923 [![Coverage Status](https://coveralls.io/builds/16935269/badge)](https://coveralls.io/builds/16935269) Coverage decreased (-0.4%) to 87.003% when pulling **d66eb287ee4a5126e2455855e00792d4a75fe01d on zhengyangyong:SCB-548** into **5c29a7cd224e788cb357e8c640a5f3473ceb0209 on apache:master**. 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 > Support Gracefully Shutdown > --- > > Key: SCB-548 > URL: https://issues.apache.org/jira/browse/SCB-548 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Java-Chassis >Affects Versions: java-chassis-1.0.0-m2 >Reporter: yangyongzheng >Assignee: yangyongzheng >Priority: Major > > We did not implement gracefully shutdown yet: > ```java > // 当程序退出时,进行相关清理,注意:kill -9 {pid}下无效 > // 1. 去注册实例信息 > // TODO 服务优雅退出 > if (applicationContext instanceof AbstractApplicationContext) { > ((AbstractApplicationContext) > applicationContext).registerShutdownHook(); > } > ``` > > And had got an issue : > https://github.com/apache/incubator-servicecomb-java-chassis/issues/685 from > user. > So it's time we must do it and remove this TODO -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Resolved] (SCB-533) javassistUtils create class from CtClass, not only JavaType
[ https://issues.apache.org/jira/browse/SCB-533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] wujimin resolved SCB-533. - Resolution: Done > javassistUtils create class from CtClass, not only JavaType > --- > > Key: SCB-533 > URL: https://issues.apache.org/jira/browse/SCB-533 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: wujimin >Assignee: wujimin >Priority: Major > Fix For: java-chassis-1.0.0-m2 > > > preparing for create recursive class -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-532) support recursive dependence
[ https://issues.apache.org/jira/browse/SCB-532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16471613#comment-16471613 ] ASF GitHub Bot commented on SCB-532: coveralls commented on issue #699: [SCB-532] Support recursive dependency URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/699#issuecomment-388288890 [![Coverage Status](https://coveralls.io/builds/16934947/badge)](https://coveralls.io/builds/16934947) Coverage decreased (-0.02%) to 87.342% when pulling **b0a9c5ca3572d985e7af0b38cf7494b8819804a9 on wujimin:support-recursive-dependency** into **5c29a7cd224e788cb357e8c640a5f3473ceb0209 on apache:master**. 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 > support recursive dependence > > > Key: SCB-532 > URL: https://issues.apache.org/jira/browse/SCB-532 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: wujimin >Assignee: wujimin >Priority: Major > Fix For: java-chassis-1.0.0-m2 > > > {code:java} > 1.class A{ > A a; > } > 2.class A{ > B b; > } > class B{ > A a; > }{code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-548) Support Gracefully Shutdown
[ https://issues.apache.org/jira/browse/SCB-548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16471603#comment-16471603 ] ASF GitHub Bot commented on SCB-548: zhengyangyong commented on issue #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#issuecomment-388286655 Rebase on latest master 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 > Support Gracefully Shutdown > --- > > Key: SCB-548 > URL: https://issues.apache.org/jira/browse/SCB-548 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Java-Chassis >Affects Versions: java-chassis-1.0.0-m2 >Reporter: yangyongzheng >Assignee: yangyongzheng >Priority: Major > > We did not implement gracefully shutdown yet: > ```java > // 当程序退出时,进行相关清理,注意:kill -9 {pid}下无效 > // 1. 去注册实例信息 > // TODO 服务优雅退出 > if (applicationContext instanceof AbstractApplicationContext) { > ((AbstractApplicationContext) > applicationContext).registerShutdownHook(); > } > ``` > > And had got an issue : > https://github.com/apache/incubator-servicecomb-java-chassis/issues/685 from > user. > So it's time we must do it and remove this TODO -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-548) Support Gracefully Shutdown
[ https://issues.apache.org/jira/browse/SCB-548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16471562#comment-16471562 ] ASF GitHub Bot commented on SCB-548: coveralls commented on issue #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#issuecomment-387664923 [![Coverage Status](https://coveralls.io/builds/16934683/badge)](https://coveralls.io/builds/16934683) Coverage decreased (-0.3%) to 87.027% when pulling **5fd157edc955812d120e1dad4765527d3699316c on zhengyangyong:SCB-548** into **cd87c96310795e1e56a69a2d23cbfe3b2f65b28f on apache:master**. 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 > Support Gracefully Shutdown > --- > > Key: SCB-548 > URL: https://issues.apache.org/jira/browse/SCB-548 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Java-Chassis >Affects Versions: java-chassis-1.0.0-m2 >Reporter: yangyongzheng >Assignee: yangyongzheng >Priority: Major > > We did not implement gracefully shutdown yet: > ```java > // 当程序退出时,进行相关清理,注意:kill -9 {pid}下无效 > // 1. 去注册实例信息 > // TODO 服务优雅退出 > if (applicationContext instanceof AbstractApplicationContext) { > ((AbstractApplicationContext) > applicationContext).registerShutdownHook(); > } > ``` > > And had got an issue : > https://github.com/apache/incubator-servicecomb-java-chassis/issues/685 from > user. > So it's time we must do it and remove this TODO -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-532) support recursive dependence
[ https://issues.apache.org/jira/browse/SCB-532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16471558#comment-16471558 ] ASF GitHub Bot commented on SCB-532: wujimin opened a new pull request #699: [SCB-532] Support recursive dependency URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/699 support create recursive dependency class ``` 1. class A { A a; } 2. class A { B b; } class B { A a; } ``` 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 > support recursive dependence > > > Key: SCB-532 > URL: https://issues.apache.org/jira/browse/SCB-532 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: wujimin >Assignee: wujimin >Priority: Major > Fix For: java-chassis-1.0.0-m2 > > > {code:java} > 1.class A{ > A a; > } > 2.class A{ > B b; > } > class B{ > A a; > }{code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-533) javassistUtils create class from CtClass, not only JavaType
[ https://issues.apache.org/jira/browse/SCB-533?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16471550#comment-16471550 ] ASF GitHub Bot commented on SCB-533: liubao68 closed pull request #696: [SCB-533] JavassistUtils create class from CtClass URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/696 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/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/ClassConfig.java b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/ClassConfig.java index 9471d7a93..bc070ba1f 100644 --- a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/ClassConfig.java +++ b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/ClassConfig.java @@ -73,9 +73,13 @@ public FieldConfig addField(String name, Type genericType) { } public FieldConfig addField(String name, JavaType javaType) { +return addField(name, new CtType(javaType)); + } + + public FieldConfig addField(String name, CtType ctType) { FieldConfig field = new FieldConfig(); field.setName(name); -field.setType(javaType); +field.setType(ctType); fieldList.add(field); diff --git a/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/CtType.java b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/CtType.java new file mode 100644 index 0..d0da1e010 --- /dev/null +++ b/common/common-javassist/src/main/java/org/apache/servicecomb/common/javassist/CtType.java @@ -0,0 +1,86 @@ +/* + * 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.servicecomb.common.javassist; + +import com.fasterxml.jackson.databind.JavaType; + +import javassist.ClassPool; +import javassist.CtClass; +import javassist.CtPrimitiveType; +import javassist.NotFoundException; + +public class CtType { + private static final ClassPool PRIMITIVE_CLASSPOOL = JavassistUtils.getOrCreateClassPool(int.class.getClassLoader()); + + private CtClass ctClass; + + private boolean hasGenericTypes; + + private String genericSignature; + + public CtType(CtClass ctClass, boolean hasGenericTypes, String genericSignature) { +init(ctClass, hasGenericTypes, genericSignature); + } + + public CtType(JavaType javaType) { +ClassLoader classLoader = javaType.getRawClass().getClassLoader(); +try { + ClassPool classPool = JavassistUtils.getOrCreateClassPool(classLoader); + init(classPool.get(javaType.getRawClass().getCanonicalName()), javaType.hasGenericTypes(), + javaType.getGenericSignature() + ); +} catch (NotFoundException e) { + throw new IllegalStateException( + String.format("Failed to get CtClass for %s in classloader %s.", + javaType.getRawClass().getName(), + classLoader), + e); +} + } + + private void init(CtClass ctClass, boolean hasGenericTypes, String genericSignature) { +if (ctClass.isPrimitive()) { + try { +ctClass = PRIMITIVE_CLASSPOOL.get(((CtPrimitiveType) ctClass).getWrapperName()); + } catch (NotFoundException e) { +throw new IllegalStateException("Impossible exception.", e); + } +} + +this.ctClass = ctClass; +// no problem: +// Ljava/util/List; +// cause problem: +// Ljava/util/List<[B;>; +// it should be Ljava/util/List<[B>; +// jackson generate genericSignature to be "Ljava/util/List<[B;>;" of List, we should convert it +this.genericSignature = genericSignature.replace("[B;>", "[B>"); +this.hasGenericTypes = hasGenericTypes; + } + + public CtClass getCtClass() { +return ctClass; + } + + public boolean hasGenericTypes() { +return this.hasGenericTypes; + } + + public String getGenericSignature() { +return genericSignature; + } +} diff --git a/common/comm
[jira] [Commented] (SCB-548) Support Gracefully Shutdown
[ https://issues.apache.org/jira/browse/SCB-548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16471548#comment-16471548 ] ASF GitHub Bot commented on SCB-548: zhengyangyong commented on issue #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#issuecomment-388278489 I had used a Semaphore in order to sync all invocation had finished.now gracefully shutdown had fixed below order : 1. Unregister microservice instance from Service Center and close vertx 2. Wait all invocation finished (delete timeout mechanism in ShutdownHandler) 3. Notify all component do clean works via Event 4. Stop transport and cc vertx to prevent blocking exit 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 > Support Gracefully Shutdown > --- > > Key: SCB-548 > URL: https://issues.apache.org/jira/browse/SCB-548 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Java-Chassis >Affects Versions: java-chassis-1.0.0-m2 >Reporter: yangyongzheng >Assignee: yangyongzheng >Priority: Major > > We did not implement gracefully shutdown yet: > ```java > // 当程序退出时,进行相关清理,注意:kill -9 {pid}下无效 > // 1. 去注册实例信息 > // TODO 服务优雅退出 > if (applicationContext instanceof AbstractApplicationContext) { > ((AbstractApplicationContext) > applicationContext).registerShutdownHook(); > } > ``` > > And had got an issue : > https://github.com/apache/incubator-servicecomb-java-chassis/issues/685 from > user. > So it's time we must do it and remove this TODO -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-548) Support Gracefully Shutdown
[ https://issues.apache.org/jira/browse/SCB-548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16471547#comment-16471547 ] ASF GitHub Bot commented on SCB-548: zhengyangyong commented on issue #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#issuecomment-388278489 I had used a Semaphore in order to sync all invocation had finished.now gracefully shutdown had fixed below order : 1. Unregister microservice instance from Service Center and close vertx 2. Wait all invocation finished (delete timeout mechanism in ShutdownHandler) 3. Notify all component do clean works via Event 4. Stop vertx to prevent blocking exit 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 > Support Gracefully Shutdown > --- > > Key: SCB-548 > URL: https://issues.apache.org/jira/browse/SCB-548 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Java-Chassis >Affects Versions: java-chassis-1.0.0-m2 >Reporter: yangyongzheng >Assignee: yangyongzheng >Priority: Major > > We did not implement gracefully shutdown yet: > ```java > // 当程序退出时,进行相关清理,注意:kill -9 {pid}下无效 > // 1. 去注册实例信息 > // TODO 服务优雅退出 > if (applicationContext instanceof AbstractApplicationContext) { > ((AbstractApplicationContext) > applicationContext).registerShutdownHook(); > } > ``` > > And had got an issue : > https://github.com/apache/incubator-servicecomb-java-chassis/issues/685 from > user. > So it's time we must do it and remove this TODO -- This message was sent by Atlassian JIRA (v7.6.3#76005)