[GitHub] coveralls commented on issue #678: [SCB-506]服务治理相关的需要事件上报
coveralls commented on issue #678: [SCB-506]服务治理相关的需要事件上报 URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/678#issuecomment-384615018 [![Coverage Status](https://coveralls.io/builds/17026195/badge)](https://coveralls.io/builds/17026195) Coverage decreased (-0.1%) to 87.261% when pulling **d08c751fea23364c603f7edf322ba3acfb9c7729 on xuyiyun0929:alarm** into **5348393b977f5e6a8eac87016dd1f969a7a1e6df 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 With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #693: [SCB-548] support gracefully shutdown
wujimin commented on a change in pull request #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#discussion_r188831625 ## File path: core/src/main/java/org/apache/servicecomb/core/SCBStatus.java ## @@ -0,0 +1,32 @@ +/* + * 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.core; + +//DOWN -> STARTING -> UP -> STOPPING -> DOWN +public enum SCBStatus { + //Chassis is Down + DOWN, + //Chassis is Starting (progressing) + STARTING, + //Chassis is Running + UP, + //Chassis is Stopping (progressing) + STOPPING, + //Chassis Init Failed + FAILED Review comment: seems that uninit failed, will set status to FAILED. so what's your design? 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
[GitHub] coveralls commented on issue #710: [SCB-588] Set archetypes sourceEncoding to UTF-8
coveralls commented on issue #710: [SCB-588] Set archetypes sourceEncoding to UTF-8 URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/710#issuecomment-389735091 [![Coverage Status](https://coveralls.io/builds/17025577/badge)](https://coveralls.io/builds/17025577) Coverage remained the same at 87.371% when pulling **12a8b582c5786072cd3b4ccaa711bd46aa9aca98 on zhengyangyong:SCB-588** into **61cda009b7ac8539364bd0f1d1855d804ea4dd27 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 With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #693: [SCB-548] support gracefully shutdown
wujimin commented on a change in pull request #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#discussion_r188831121 ## File path: core/src/main/java/org/apache/servicecomb/core/SCBEngine.java ## @@ -0,0 +1,272 @@ +/* + * 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.core; + +import java.util.Collection; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; + +import org.apache.servicecomb.core.BootListener.BootEvent; +import org.apache.servicecomb.core.BootListener.EventType; +import org.apache.servicecomb.core.definition.loader.SchemaListenerManager; +import org.apache.servicecomb.core.endpoint.AbstractEndpointsCache; +import org.apache.servicecomb.core.event.InvocationFinishEvent; +import org.apache.servicecomb.core.event.InvocationStartEvent; +import org.apache.servicecomb.core.handler.HandlerConfigUtils; +import org.apache.servicecomb.core.provider.consumer.ConsumerProviderManager; +import org.apache.servicecomb.core.provider.producer.ProducerProviderManager; +import org.apache.servicecomb.core.transport.TransportManager; +import org.apache.servicecomb.foundation.common.event.EventManager; +import org.apache.servicecomb.foundation.vertx.VertxUtils; +import org.apache.servicecomb.serviceregistry.RegistryUtils; +import org.apache.servicecomb.serviceregistry.task.MicroserviceInstanceRegisterTask; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.StringUtils; + +import com.google.common.eventbus.AllowConcurrentEvents; +import com.google.common.eventbus.EventBus; +import com.google.common.eventbus.Subscribe; + +// TODO: should not depend on spring, that will make integration more flexible +public class SCBEngine { + private static final Logger LOGGER = LoggerFactory.getLogger(SCBEngine.class); + + private ProducerProviderManager producerProviderManager; + + private ConsumerProviderManager consumerProviderManager; + + private TransportManager transportManager; + + private SchemaListenerManager schemaListenerManager; + + private Collection bootListenerList; + + private final AtomicLong invocationStartedCounter = new AtomicLong(); + + private final AtomicLong invocationFinishedCounter = new AtomicLong(); + + private volatile SCBStatus status = SCBStatus.DOWN; + + public void setStatus(SCBStatus status) { +this.status = status; + } + + public SCBStatus getStatus() { +return status; + } + + private EventBus eventBus = EventManager.getEventBus(); + + private static final SCBEngine INSTANCE = new SCBEngine(); + + public static SCBEngine getInstance() { +return INSTANCE; + } + + public void setProducerProviderManager( + ProducerProviderManager producerProviderManager) { +this.producerProviderManager = producerProviderManager; + } + + public void setConsumerProviderManager( + ConsumerProviderManager consumerProviderManager) { +this.consumerProviderManager = consumerProviderManager; + } + + public TransportManager getTransportManager() { +return transportManager; + } + + public void setTransportManager(TransportManager transportManager) { +this.transportManager = transportManager; + } + + public void setSchemaListenerManager( + SchemaListenerManager schemaListenerManager) { +this.schemaListenerManager = schemaListenerManager; + } + + public Collection getBootListenerList() { +return bootListenerList; + } + + public void setBootListenerList(Collection bootListenerList) { +this.bootListenerList = bootListenerList; + } + + protected void triggerEvent(EventType eventType) { +BootEvent event = new BootEvent(); +event.setEventType(eventType); + +for (BootListener listener : bootListenerList) { + listener.onBootEvent(event); +} + } + + protected void safeTriggerEvent(EventType eventType) { +BootEvent event = new BootEvent(); +event.setEventType(eventType); + +for (BootListener listener : bootListenerList) { + try { +listener.onBootEvent(event); +LOGGER.info("BootListener {} succeed to process {}.", listener.getClass().getName(),
[GitHub] zhengyangyong commented on a change in pull request #693: [SCB-548] support gracefully shutdown
zhengyangyong commented on a change in pull request #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#discussion_r188829358 ## File path: core/src/main/java/org/apache/servicecomb/core/SCBEngine.java ## @@ -0,0 +1,272 @@ +/* + * 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.core; + +import java.util.Collection; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; + +import org.apache.servicecomb.core.BootListener.BootEvent; +import org.apache.servicecomb.core.BootListener.EventType; +import org.apache.servicecomb.core.definition.loader.SchemaListenerManager; +import org.apache.servicecomb.core.endpoint.AbstractEndpointsCache; +import org.apache.servicecomb.core.event.InvocationFinishEvent; +import org.apache.servicecomb.core.event.InvocationStartEvent; +import org.apache.servicecomb.core.handler.HandlerConfigUtils; +import org.apache.servicecomb.core.provider.consumer.ConsumerProviderManager; +import org.apache.servicecomb.core.provider.producer.ProducerProviderManager; +import org.apache.servicecomb.core.transport.TransportManager; +import org.apache.servicecomb.foundation.common.event.EventManager; +import org.apache.servicecomb.foundation.vertx.VertxUtils; +import org.apache.servicecomb.serviceregistry.RegistryUtils; +import org.apache.servicecomb.serviceregistry.task.MicroserviceInstanceRegisterTask; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.StringUtils; + +import com.google.common.eventbus.AllowConcurrentEvents; +import com.google.common.eventbus.EventBus; +import com.google.common.eventbus.Subscribe; + +// TODO: should not depend on spring, that will make integration more flexible +public class SCBEngine { + private static final Logger LOGGER = LoggerFactory.getLogger(SCBEngine.class); + + private ProducerProviderManager producerProviderManager; + + private ConsumerProviderManager consumerProviderManager; + + private TransportManager transportManager; + + private SchemaListenerManager schemaListenerManager; + + private Collection bootListenerList; + + private final AtomicLong invocationStartedCounter = new AtomicLong(); + + private final AtomicLong invocationFinishedCounter = new AtomicLong(); + + private volatile SCBStatus status = SCBStatus.DOWN; + + public void setStatus(SCBStatus status) { +this.status = status; + } + + public SCBStatus getStatus() { +return status; + } + + private EventBus eventBus = EventManager.getEventBus(); + + private static final SCBEngine INSTANCE = new SCBEngine(); + + public static SCBEngine getInstance() { +return INSTANCE; + } + + public void setProducerProviderManager( + ProducerProviderManager producerProviderManager) { +this.producerProviderManager = producerProviderManager; + } + + public void setConsumerProviderManager( + ConsumerProviderManager consumerProviderManager) { +this.consumerProviderManager = consumerProviderManager; + } + + public TransportManager getTransportManager() { +return transportManager; + } + + public void setTransportManager(TransportManager transportManager) { +this.transportManager = transportManager; + } + + public void setSchemaListenerManager( + SchemaListenerManager schemaListenerManager) { +this.schemaListenerManager = schemaListenerManager; + } + + public Collection getBootListenerList() { +return bootListenerList; + } + + public void setBootListenerList(Collection bootListenerList) { +this.bootListenerList = bootListenerList; + } + + protected void triggerEvent(EventType eventType) { +BootEvent event = new BootEvent(); +event.setEventType(eventType); + +for (BootListener listener : bootListenerList) { + listener.onBootEvent(event); +} + } + + protected void safeTriggerEvent(EventType eventType) { +BootEvent event = new BootEvent(); +event.setEventType(eventType); + +for (BootListener listener : bootListenerList) { + try { +listener.onBootEvent(event); +LOGGER.info("BootListener {} succeed to process {}.",
[GitHub] codecov-io commented on issue #352: SCB-393 Retry to request etcd too frequently when fail
codecov-io commented on issue #352: SCB-393 Retry to request etcd too frequently when fail URL: https://github.com/apache/incubator-servicecomb-service-center/pull/352#issuecomment-389732060 # [Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352?src=pr=h1) Report > Merging [#352](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352?src=pr=desc) into [master](https://codecov.io/gh/apache/incubator-servicecomb-service-center/commit/3618245c56360a24df606a7daf78586ac006dca3?src=pr=desc) will **increase** coverage by `0.02%`. > The diff coverage is `97.43%`. [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352/graphs/tree.svg?token=GAaF7zrg8R=pr=650=150)](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352?src=pr=tree) ```diff @@Coverage Diff @@ ## master #352 +/- ## == + Coverage 69.88% 69.91% +0.02% == Files 18 18 Lines3420 3420 == + Hits 2390 2391 +1 Misses865 865 + Partials 165 164 -1 ``` | [Impacted Files](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352?src=pr=tree) | Coverage Δ | | |---|---|---| | [server/service/util/heartbeat\_util.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvdXRpbC9oZWFydGJlYXRfdXRpbC5nbw==) | `80% <100%> (ø)` | :arrow_up: | | [server/service/util/microservice\_util.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvdXRpbC9taWNyb3NlcnZpY2VfdXRpbC5nbw==) | `74.84% <100%> (ø)` | :arrow_up: | | [server/service/util/dependency.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvdXRpbC9kZXBlbmRlbmN5Lmdv) | `56.37% <100%> (ø)` | :arrow_up: | | [server/service/microservices.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvbWljcm9zZXJ2aWNlcy5nbw==) | `74.55% <100%> (ø)` | :arrow_up: | | [server/service/util/schema\_util.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvdXRpbC9zY2hlbWFfdXRpbC5nbw==) | `87.5% <100%> (ø)` | :arrow_up: | | [server/service/util/domain\_util.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvdXRpbC9kb21haW5fdXRpbC5nbw==) | `71.64% <100%> (ø)` | :arrow_up: | | [server/service/util/rule\_util.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvdXRpbC9ydWxlX3V0aWwuZ28=) | `67.5% <100%> (ø)` | :arrow_up: | | [server/service/util/tag\_util.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvdXRpbC90YWdfdXRpbC5nbw==) | `65.51% <100%> (ø)` | :arrow_up: | | [server/service/schema.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2Uvc2NoZW1hLmdv) | `75% <100%> (ø)` | :arrow_up: | | [server/service/util/instance\_util.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvdXRpbC9pbnN0YW5jZV91dGlsLmdv) | `48.36% <88.88%> (ø)` | :arrow_up: | | ... and [1 more](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352/diff?src=pr=tree-more) | | -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352?src=pr=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352?src=pr=footer). Last update [3618245...7ff4463](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/352?src=pr=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). 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
[GitHub] coveralls commented on issue #352: SCB-393 Retry to request etcd too frequently when fail
coveralls commented on issue #352: SCB-393 Retry to request etcd too frequently when fail URL: https://github.com/apache/incubator-servicecomb-service-center/pull/352#issuecomment-389720468 [![Coverage Status](https://coveralls.io/builds/17025456/badge)](https://coveralls.io/builds/17025456) Coverage increased (+0.1%) to 73.468% when pulling **7ff446331fbd29df31dcaeb78270cf06c07d7b47 on little-cui:master** into **3618245c56360a24df606a7daf78586ac006dca3 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 With regards, Apache Git Services
[GitHub] zhengyangyong opened a new pull request #710: [SCB-588] Set archetypes sourceEncoding to UTF-8
zhengyangyong opened a new pull request #710: [SCB-588] Set archetypes sourceEncoding to UTF-8 URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/710 Signed-off-by: zhengyangyongFollow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- 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
[GitHub] wujimin commented on a change in pull request #693: [SCB-548] support gracefully shutdown
wujimin commented on a change in pull request #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#discussion_r188827460 ## File path: core/src/main/java/org/apache/servicecomb/core/SCBEngine.java ## @@ -0,0 +1,272 @@ +/* + * 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.core; + +import java.util.Collection; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; + +import org.apache.servicecomb.core.BootListener.BootEvent; +import org.apache.servicecomb.core.BootListener.EventType; +import org.apache.servicecomb.core.definition.loader.SchemaListenerManager; +import org.apache.servicecomb.core.endpoint.AbstractEndpointsCache; +import org.apache.servicecomb.core.event.InvocationFinishEvent; +import org.apache.servicecomb.core.event.InvocationStartEvent; +import org.apache.servicecomb.core.handler.HandlerConfigUtils; +import org.apache.servicecomb.core.provider.consumer.ConsumerProviderManager; +import org.apache.servicecomb.core.provider.producer.ProducerProviderManager; +import org.apache.servicecomb.core.transport.TransportManager; +import org.apache.servicecomb.foundation.common.event.EventManager; +import org.apache.servicecomb.foundation.vertx.VertxUtils; +import org.apache.servicecomb.serviceregistry.RegistryUtils; +import org.apache.servicecomb.serviceregistry.task.MicroserviceInstanceRegisterTask; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.StringUtils; + +import com.google.common.eventbus.AllowConcurrentEvents; +import com.google.common.eventbus.EventBus; +import com.google.common.eventbus.Subscribe; + +// TODO: should not depend on spring, that will make integration more flexible +public class SCBEngine { + private static final Logger LOGGER = LoggerFactory.getLogger(SCBEngine.class); + + private ProducerProviderManager producerProviderManager; + + private ConsumerProviderManager consumerProviderManager; + + private TransportManager transportManager; + + private SchemaListenerManager schemaListenerManager; + + private Collection bootListenerList; + + private final AtomicLong invocationStartedCounter = new AtomicLong(); + + private final AtomicLong invocationFinishedCounter = new AtomicLong(); + + private volatile SCBStatus status = SCBStatus.DOWN; + + public void setStatus(SCBStatus status) { +this.status = status; + } + + public SCBStatus getStatus() { +return status; + } + + private EventBus eventBus = EventManager.getEventBus(); + + private static final SCBEngine INSTANCE = new SCBEngine(); + + public static SCBEngine getInstance() { +return INSTANCE; + } + + public void setProducerProviderManager( + ProducerProviderManager producerProviderManager) { +this.producerProviderManager = producerProviderManager; + } + + public void setConsumerProviderManager( + ConsumerProviderManager consumerProviderManager) { +this.consumerProviderManager = consumerProviderManager; + } + + public TransportManager getTransportManager() { +return transportManager; + } + + public void setTransportManager(TransportManager transportManager) { +this.transportManager = transportManager; + } + + public void setSchemaListenerManager( + SchemaListenerManager schemaListenerManager) { +this.schemaListenerManager = schemaListenerManager; + } + + public Collection getBootListenerList() { +return bootListenerList; + } + + public void setBootListenerList(Collection bootListenerList) { +this.bootListenerList = bootListenerList; + } + + protected void triggerEvent(EventType eventType) { +BootEvent event = new BootEvent(); +event.setEventType(eventType); + +for (BootListener listener : bootListenerList) { + listener.onBootEvent(event); +} + } + + protected void safeTriggerEvent(EventType eventType) { +BootEvent event = new BootEvent(); +event.setEventType(eventType); + +for (BootListener listener : bootListenerList) { + try { +listener.onBootEvent(event); +LOGGER.info("BootListener {} succeed to process {}.", listener.getClass().getName(),
[GitHub] liubao68 commented on a change in pull request #704: [SCB-582]Provide a way to protect instance removal
liubao68 commented on a change in pull request #704: [SCB-582]Provide a way to protect instance removal URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/704#discussion_r188826558 ## File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/consumer/SimpleMicroserviceInstancePing.java ## @@ -0,0 +1,47 @@ +/* + * 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.serviceregistry.consumer; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.servicecomb.foundation.common.net.IpPort; +import org.apache.servicecomb.foundation.common.net.NetUtils; +import org.apache.servicecomb.serviceregistry.api.registry.MicroserviceInstance; + +/** + * Simple implementation of .MicroserviceInstancePing using telnet + */ +public class SimpleMicroserviceInstancePing implements MicroserviceInstancePing { + @Override + public int getOrder() { +return 100; + } + + @Override + public boolean ping(MicroserviceInstance instance) { +if (instance.getEndpoints() != null && instance.getEndpoints().size() > 0) { + IpPort ipPort = NetUtils.parseIpPortFromURI(instance.getEndpoints().get(0)); + try (Socket s = new Socket(ipPort.getHostOrIp(), ipPort.getPort())) { Review comment: I have think this problem very carefully. This mechanism only work when client get empty instances list, and we face this problem due to service center bugs, unexpected start/stop of microservices and service center, and other network failures not properly handled. In theory, these problems should be properly handled and SDK do not need to care about it, but It happens very frequently. So we add this mechanism to make SDK itself more stable in bad circumstances. Since SDK will query instances periodically, after there are instances, no problem for your mentioned scenario. And if even your scenario happens(rarely), this time, to consumer both of them are failures(no instance vs send to wrong destination). This time is very short and acceptable. And ping logic is extensible by users, they may cover the problem too. 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
[GitHub] liubao68 commented on a change in pull request #704: [SCB-582]Provide a way to protect instance removal
liubao68 commented on a change in pull request #704: [SCB-582]Provide a way to protect instance removal URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/704#discussion_r188826558 ## File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/consumer/SimpleMicroserviceInstancePing.java ## @@ -0,0 +1,47 @@ +/* + * 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.serviceregistry.consumer; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.servicecomb.foundation.common.net.IpPort; +import org.apache.servicecomb.foundation.common.net.NetUtils; +import org.apache.servicecomb.serviceregistry.api.registry.MicroserviceInstance; + +/** + * Simple implementation of .MicroserviceInstancePing using telnet + */ +public class SimpleMicroserviceInstancePing implements MicroserviceInstancePing { + @Override + public int getOrder() { +return 100; + } + + @Override + public boolean ping(MicroserviceInstance instance) { +if (instance.getEndpoints() != null && instance.getEndpoints().size() > 0) { + IpPort ipPort = NetUtils.parseIpPortFromURI(instance.getEndpoints().get(0)); + try (Socket s = new Socket(ipPort.getHostOrIp(), ipPort.getPort())) { Review comment: I have think this problem very carefully. This mechanism only work when client get empty instances list, and we face this problem due to service center bugs, unexpected start/stop of microservices and service center, and other network failures not properly handled. In theory, these problems should be properly handled and SDK do not need to care about it, but It happens very frequently. So we add this mechanism to make SDK itself more stable in bad circumstances. Since SDK will query instances periodically, after there are instances, no problem for your mentioned scenario. And if even your scenario happens(rarely), this time, to consumer both of them are failures(no instance vs send to wrong destination). This time is very short and acceptable. 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
[GitHub] wujimin commented on a change in pull request #702: [SCB-580] fix response of the upload file too large
wujimin commented on a change in pull request #702: [SCB-580] fix response of the upload file too large URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/702#discussion_r188826253 ## File path: transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestDispatcher.java ## @@ -64,9 +70,106 @@ private void failureHandler(RoutingContext context) { e = cause; } } -restProducerInvocation.sendFailResponse(e); -// 走到这里,应该都是不可控制的异常,直接关闭连接 +// only when unexpected exception happens, it will run into here. +// the connection should be closed. +handleFailureAndClose(context, restProducerInvocation, e); + } + + /** + * Try to find out the failure information and send it in response. + */ + private void handleFailureAndClose(RoutingContext context, AbstractRestInvocation restProducerInvocation, + Throwable e) { +if (null != restProducerInvocation) { + // if there is restProducerInvocation, let it send exception in response. The exception is allowed to be null. + sendFailResponseByInvocation(context, restProducerInvocation, e); + return; +} + +if (null != e) { + // if there exists exception, try to send this exception by RoutingContext + sendExceptionByRoutingContext(context, e); + return; +} + +// if there is no exception, the response is determined by status code. +sendFailureRespDeterminedByStatus(context); + } + + /** + * Try to determine response by status code, and send response. + */ + private void sendFailureRespDeterminedByStatus(RoutingContext context) { +Family statusFamily = Family.familyOf(context.statusCode()); +if (Family.CLIENT_ERROR.equals(statusFamily) || Family.SERVER_ERROR.equals(statusFamily) || Family.OTHER +.equals(statusFamily)) { + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(context.statusCode()).end(); +} else { + // it seems the status code is not set properly + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()) + .setStatusMessage(Status.INTERNAL_SERVER_ERROR.getReasonPhrase()) + .end(wrapResponseBody(Status.INTERNAL_SERVER_ERROR.getReasonPhrase())); +} +context.response().close(); + } + + /** + * Use routingContext to send failure information in throwable. + */ + private void sendExceptionByRoutingContext(RoutingContext context, Throwable e) { +if (InvocationException.class.isInstance(e)) { + InvocationException invocationException = (InvocationException) e; + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(invocationException.getStatusCode()).setStatusMessage(invocationException.getReasonPhrase()) + .end(wrapResponseBody(invocationException.getReasonPhrase())); +} else { + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).end(wrapResponseBody(e.getMessage())); +} +context.response().close(); + } + + /** + * Consumer will treat the response body as json by default, so it's necessary to wrap response body as Json string + * to avoid deserialization error. + * + * @param message response body + * @return response body wrapped as Json string + */ + String wrapResponseBody(String message) { +if (isValidJson(message)) { + return message; +} + +JsonObject jsonObject = new JsonObject(); +jsonObject.put("message", message); + +return jsonObject.toString(); Review comment: ok because your last commit just return a string, now return a CommonExceptionData structure, so i have this question 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
[GitHub] coveralls commented on issue #352: SCB-393 Retry to request etcd too frequently when fail
coveralls commented on issue #352: SCB-393 Retry to request etcd too frequently when fail URL: https://github.com/apache/incubator-servicecomb-service-center/pull/352#issuecomment-389720468 [![Coverage Status](https://coveralls.io/builds/17024811/badge)](https://coveralls.io/builds/17024811) Coverage increased (+0.05%) to 73.415% when pulling **9078caef59b40d3a624d0c3d3d35326a35e423c0 on little-cui:master** into **3618245c56360a24df606a7daf78586ac006dca3 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 With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #704: [SCB-582]Provide a way to protect instance removal
wujimin commented on a change in pull request #704: [SCB-582]Provide a way to protect instance removal URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/704#discussion_r188819940 ## File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/consumer/SimpleMicroserviceInstancePing.java ## @@ -0,0 +1,47 @@ +/* + * 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.serviceregistry.consumer; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.servicecomb.foundation.common.net.IpPort; +import org.apache.servicecomb.foundation.common.net.NetUtils; +import org.apache.servicecomb.serviceregistry.api.registry.MicroserviceInstance; + +/** + * Simple implementation of .MicroserviceInstancePing using telnet + */ +public class SimpleMicroserviceInstancePing implements MicroserviceInstancePing { + @Override + public int getOrder() { +return 100; + } + + @Override + public boolean ping(MicroserviceInstance instance) { +if (instance.getEndpoints() != null && instance.getEndpoints().size() > 0) { + IpPort ipPort = NetUtils.parseIpPortFromURI(instance.getEndpoints().get(0)); + try (Socket s = new Socket(ipPort.getHostOrIp(), ipPort.getPort())) { Review comment: lost heartbeat means tens of seconds passed if deployment managered by docker, in this time, maybe already start another microservce instance for this ip and port 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
[GitHub] little-cui opened a new pull request #352: SCB-393 Retry to request etcd too frequently when fail
little-cui opened a new pull request #352: SCB-393 Retry to request etcd too frequently when fail URL: https://github.com/apache/incubator-servicecomb-service-center/pull/352 Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `go build` `go test` `go fmt` `go vet` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- 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
[GitHub] wujimin commented on a change in pull request #709: [SCB-587] Fix archetypes readme
wujimin commented on a change in pull request #709: [SCB-587] Fix archetypes readme URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/709#discussion_r188818126 ## File path: archetypes/README.md ## @@ -46,6 +46,7 @@ mvn archetype:generate -DarchetypeGroupId=org.apache.servicecomb.archetypes -Dar In console Interactive mode, input your GroupId, ArtifactId and Version of new project(module), after a while the new project will be generated. *Notice: We will publish these archetypes to maven center repository since 1.0.0-m2, if you would like to use an archetype from an unreleased version : * + ```bash -mvn archetype:generate -DarchetypeGroupId=org.apache.servicecomb.archetypes -DarchetypeArtifactId=business-service-jaxrs-archetype -DarchetypeVersion=${archetype-version} -DarchetypeRepository=https://repository.apache.org/content/groups/snapshots-group +mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=org.apache.servicecomb.archetypes -DarchetypeArtifactId=business-service-jaxrs-archetype -DarchetypeVersion=1.0.0-m2-SNAPSHOT -DarchetypeRepository=https://repository.apache.org/content/groups/snapshots-group Review comment: ok, i see but maybe encoding is a problem. 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
[GitHub] zhengyangyong commented on a change in pull request #709: [SCB-587] Fix archetypes readme
zhengyangyong commented on a change in pull request #709: [SCB-587] Fix archetypes readme URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/709#discussion_r188814722 ## File path: archetypes/README.md ## @@ -46,6 +46,7 @@ mvn archetype:generate -DarchetypeGroupId=org.apache.servicecomb.archetypes -Dar In console Interactive mode, input your GroupId, ArtifactId and Version of new project(module), after a while the new project will be generated. *Notice: We will publish these archetypes to maven center repository since 1.0.0-m2, if you would like to use an archetype from an unreleased version : * + ```bash -mvn archetype:generate -DarchetypeGroupId=org.apache.servicecomb.archetypes -DarchetypeArtifactId=business-service-jaxrs-archetype -DarchetypeVersion=${archetype-version} -DarchetypeRepository=https://repository.apache.org/content/groups/snapshots-group +mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=org.apache.servicecomb.archetypes -DarchetypeArtifactId=business-service-jaxrs-archetype -DarchetypeVersion=1.0.0-m2-SNAPSHOT -DarchetypeRepository=https://repository.apache.org/content/groups/snapshots-group Review comment: mvn archetype:generate may use latest version 3.0+ of archetype-plugin,archetypeRepository had deleted,https://maven.apache.org/archetype/maven-archetype-plugin/generate-mojo.html 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
[GitHub] little-cui closed pull request #350: SCB-581 static data return instance count by domain
little-cui closed pull request #350: SCB-581 static data return instance count by domain URL: https://github.com/apache/incubator-servicecomb-service-center/pull/350 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/server/core/proto/services.pb.go b/server/core/proto/services.pb.go index a2fc237f..fe5a3fd6 100644 --- a/server/core/proto/services.pb.go +++ b/server/core/proto/services.pb.go @@ -1,20 +1,3 @@ -/* - * 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. - */ - // Code generated by protoc-gen-go. DO NOT EDIT. // source: services.proto @@ -334,7 +317,8 @@ func (m *StService) GetOnlineCount() int64 { } type StInstance struct { - Count int64 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"` + Count int64 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"` + CountByDomain int64 `protobuf:"varint,2,opt,name=countByDomain" json:"countByDomain,omitempty"` } func (m *StInstance) Reset(){ *m = StInstance{} } @@ -349,6 +333,13 @@ func (m *StInstance) GetCount() int64 { return 0 } +func (m *StInstance) GetCountByDomain() int64 { + if m != nil { + return m.CountByDomain + } + return 0 +} + type StApp struct { Count int64 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"` } @@ -4235,220 +4226,221 @@ var _GovernServiceCtrl_serviceDesc = grpc.ServiceDesc{ func init() { proto1.RegisterFile("services.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 3433 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5c, 0xdb, 0x8f, 0x1c, 0xc5, - 0xd5, 0x57, 0xcd, 0xce, 0xec, 0xec, 0x9c, 0xbd, 0xd8, 0x5b, 0xde, 0xf5, 0xb6, 0x07, 0x3e, 0x3e, - 0xab, 0x85, 0xf4, 0xf1, 0x80, 0xf6, 0x83, 0xe5, 0x03, 0xfc, 0x19, 0x1b, 0xb3, 0x17, 0x63, 0xaf, - 0xc1, 0xd8, 0xf4, 0x2c, 0x76, 0x80, 0x24, 0xa8, 0x77, 0xa6, 0x76, 0xa6, 0xf1, 0x4c, 0x77, 0xd3, - 0xdd, 0xb3, 0x66, 0xa4, 0x48, 0x11, 0x08, 0x12, 0x12, 0x12, 0x08, 0x4a, 0xf2, 0xc4, 0x43, 0xa2, - 0x24, 0x3c, 0x46, 0x4a, 0xa2, 0x48, 0x28, 0x42, 0x89, 0xa2, 0x44, 0x79, 0x83, 0xc7, 0x28, 0x4f, - 0xc9, 0x7b, 0xa4, 0xbc, 0xe5, 0x0f, 0x48, 0x54, 0x97, 0xee, 0xae, 0xbe, 0xec, 0x6e, 0x5f, 0xb6, - 0x41, 0x79, 0xda, 0xae, 0xea, 0xa9, 0x53, 0xe7, 0xd4, 0xb9, 0xd4, 0xa9, 0x5f, 0x9d, 0x6d, 0x58, - 0x70, 0x89, 0xb3, 0x6f, 0x74, 0x89, 0xbb, 0x6a, 0x3b, 0x96, 0x67, 0xe1, 0xff, 0xe9, 0x5a, 0xa3, - 0xd5, 0xc1, 0x58, 0xbf, 0x4b, 0x8c, 0x55, 0x5b, 0xd7, 0xdd, 0xd5, 0xae, 0x4b, 0x56, 0xc5, 0x6f, - 0x1c, 0xd2, 0x37, 0x5c, 0xcf, 0x99, 0xac, 0xea, 0xb6, 0xa1, 0x7e, 0x1d, 0x96, 0xae, 0x5b, 0x3d, - 0x63, 0x6f, 0xd2, 0xe9, 0x0e, 0xc8, 0x48, 0x77, 0x35, 0xf2, 0xda, 0x98, 0xb8, 0x1e, 0xbe, 0x17, - 0x5a, 0xe2, 0xe7, 0xdb, 0x3d, 0x05, 0x9d, 0x45, 0x0f, 0xb4, 0xb4, 0xb0, 0x03, 0x6f, 0x43, 0xd3, - 0xe5, 0xbf, 0x57, 0x6a, 0x67, 0xa7, 0x1e, 0x98, 0x5d, 0xfb, 0xdf, 0xd5, 0x8c, 0x13, 0xae, 0xf2, - 0x79, 0x34, 0x7f, 0xbc, 0x7a, 0x0b, 0xa6, 0x79, 0x17, 0x6e, 0xc3, 0x0c, 0xef, 0x0c, 0x66, 0x0c, - 0xda, 0x58, 0x81, 0xa6, 0x3b, 0x1e, 0x8d, 0x74, 0x67, 0xa2, 0xd4, 0xd8, 0x2b, 0xbf, 0x89, 0x4f, - 0xc3, 0x34, 0xff, 0x95, 0x32, 0xc5, 0x5e, 0x88, 0x96, 0xba, 0x07, 0xcb, 0x31, 0xc1, 0x5c, 0xdb, - 0x32, 0x5d, 0x82, 0xaf, 0xc3, 0x8c, 0x23, 0x9e, 0xd9, 0x34, 0xb3, 0x6b, 0x0f, 0x67, 0x66, 0xde, - 0x27, 0xa2, 0x05, 0x24, 0xd4, 0xd7, 0xe0, 0xd4, 0x55, 0xa2, 0x3b, 0xde, 0x2e, 0xd1, 0xbd, 0x0e, - 0xf1, 0xfc, 0xf5, 0x7b, 0x09, 0x5a, 0x86, 0xe9, 0x7a, 0xba, 0xd9, 0x25, 0xae, 0x82, 0xd8, 0x1a, - 0x5d, 0xc8, 0x3c, 0x8d, 0x4c, 0xf0, 0xf2, 0x90, 0x8c, 0x88, 0xe9, 0x69, 0x21, 0x39, 0xb5, 0x13, - 0x9d, 0x52, 0xfc, 0xe2, 0x08, 0x95, 0xdd, 0x07, 0xe0, 0x53, 0xd8, 0xee, 0x89, 0x45, 0x94, 0x7a, - 0xd4, 0x4f, 0x10, 0x2c, 0x45, 0x05, 0xa9, 0x64, 0xbd, 0xf0, 0x8e, 0xbc, 0x30, 0xdc, 0x78, 0x1e, - 0xcb,
[GitHub] wujimin commented on a change in pull request #709: [SCB-587] Fix archetypes readme
wujimin commented on a change in pull request #709: [SCB-587] Fix archetypes readme URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/709#discussion_r188812151 ## File path: archetypes/README.md ## @@ -46,6 +46,7 @@ mvn archetype:generate -DarchetypeGroupId=org.apache.servicecomb.archetypes -Dar In console Interactive mode, input your GroupId, ArtifactId and Version of new project(module), after a while the new project will be generated. *Notice: We will publish these archetypes to maven center repository since 1.0.0-m2, if you would like to use an archetype from an unreleased version : * + ```bash -mvn archetype:generate -DarchetypeGroupId=org.apache.servicecomb.archetypes -DarchetypeArtifactId=business-service-jaxrs-archetype -DarchetypeVersion=${archetype-version} -DarchetypeRepository=https://repository.apache.org/content/groups/snapshots-group +mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=org.apache.servicecomb.archetypes -DarchetypeArtifactId=business-service-jaxrs-archetype -DarchetypeVersion=1.0.0-m2-SNAPSHOT -DarchetypeRepository=https://repository.apache.org/content/groups/snapshots-group Review comment: by the old command, i succeeed to create project and run "mvn install" (just copy and run, did no change anything, even did not replace ${archetype-version} to be 1.0.0-m2-SNAPSHOT) so why we need to do this change? and maybe this is a problem: [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ aid --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent! [INFO] Compiling 3 source files to D:\aid\target\classes 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
[GitHub] wuzunqian commented on a change in pull request #185: [SCB-245]: add acceptance test for dubbo demo
wuzunqian commented on a change in pull request #185: [SCB-245]: add acceptance test for dubbo demo URL: https://github.com/apache/incubator-servicecomb-saga/pull/185#discussion_r188628445 ## File path: omega/omega-transport/omega-transport-dubbo/src/test/java/SagaDubboProviderFilterTest.java ## @@ -45,7 +45,6 @@ @Before public void setUp() { omegaContext.clear(); -ApplicationContext applicationContext = mock(ApplicationContext.class); Review comment: yes, I have fix it at this commit : 2fda9f6, but The Travis CI build failed 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
[GitHub] coveralls commented on issue #709: [SCB-587] Fix archetypes readme
coveralls commented on issue #709: [SCB-587] Fix archetypes readme URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/709#issuecomment-389490999 [![Coverage Status](https://coveralls.io/builds/17010314/badge)](https://coveralls.io/builds/17010314) Coverage increased (+0.005%) to 87.376% when pulling **96354f05addd301a76bf57a1d5fe3a56cb6f5ad8 on zhengyangyong:SCB-587** into **61cda009b7ac8539364bd0f1d1855d804ea4dd27 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 With regards, Apache Git Services
[GitHub] zhengyangyong opened a new pull request #709: SCB-587 Fix archetypes readme
zhengyangyong opened a new pull request #709: SCB-587 Fix archetypes readme URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/709 Signed-off-by: zhengyangyongFollow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- update generate from snapshot repo command 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
[incubator-servicecomb-java-chassis] branch gh-pages updated: [SCB-585]update README.md
This is an automated email from the ASF dual-hosted git repository. liubao pushed a commit to branch gh-pages in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git The following commit(s) were added to refs/heads/gh-pages by this push: new 51848b8 [SCB-585]update README.md 51848b8 is described below commit 51848b8468159e8bda31c19a31009434645cf58e Author: liubaoAuthorDate: Wed May 16 17:54:53 2018 +0800 [SCB-585]update README.md --- README.md | 84 +++ 1 file changed, 20 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index f29b1eb..c665f2b 100644 --- a/README.md +++ b/README.md @@ -1,74 +1,30 @@ -# Java Chassis -[![Build Status](https://travis-ci.org/apache/incubator-servicecomb-java-chassis.svg?branch=master)](https://travis-ci.org/apache/incubator-servicecomb-java-chassis?branch=master) [![Coverage Status](https://coveralls.io/repos/github/apache/incubator-servicecomb-java-chassis/badge.svg?branch=master)](https://coveralls.io/github/apache/incubator-servicecomb-java-chassis?branch=master) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.servicecomb/java-chassis-co [...] +## 本项目是servicecomb-java-chassis开发指南。 -Apache ServiceComb (incubating) Java Chassis is a Software Development Kit (SDK) for rapid development of microservices in Java, providing service registration, service discovery, dynamic routing, and service management features +* [访问地址](https://huaweicse.github.io/servicecomb-java-chassis-doc) -## Quick Start +* 编辑 + 1. Fork本项目代码 + 2. 方式一:直接编辑docs-source里面的md源码 + 3. 方式二:下载[GitBook Editor](https://legacy.gitbook.com/editor)编辑 + 4. 提交PR -Provider service: -```java -import org.apache.servicecomb.*; -@RpcSchema(schemaId = "helloworld") -public class HelloWorldProvider implements HelloWorld { -public String sayHello(String name) { -return "Hello " + name; -} -} -``` +* 发布 + 1. 参考[GitBook安装指南](https://github.com/GitbookIO/gitbook/blob/master/docs/setup.md),安装gitbook + 2. gitbook build . ./docs -Consumer service: -```java -import org.apache.servicecomb.*; -@Component -public class HelloWorldConsumer { - @RpcReference(microserviceName = "pojo", schemaId = "helloworld") - private static HelloWorld helloWorld; +## This project is the servicecomb-java-chassis developers guide - public static void main(String[] args) { - helloWorld.sayHello("Tank"); - } -} -``` +* [Web address](https://huaweicse.github.io/servicecomb-java-chassis-doc) -## Documentation +* Submit PR + 1. Fork this project + 2. Edit md source file, or + 3. Edit using [GitBook Editor](https://legacy.gitbook.com/editor) + 4. Submit PR -Project documentation is available on the [ServiceComb website][servicecomb-website]. +* Publish + 1. see [GitBook installation guide](https://github.com/GitbookIO/gitbook/blob/master/docs/setup.md) + 2. gitbook build . ./docs -[servicecomb-website]: http://servicecomb.incubator.apache.org/ -## Building -You don’t need to build from source to use Java Chassis (binaries in apache nexus ), but if you want to try out the latest and greatest, Java Chassis can be easily built with the maven. You also need JDK 1.8. - - mvn clean install - -If you want to build the release kits from the source - - mvn clean install -Prelease,distribution - -The first build may take a longer than expected as Maven downloads all the dependencies. - -## Automated Testing - - To build the docker image and run the integration tests with docker, you can use maven docker profile - - mvn clean install -Pdocker -Pit - - If you are using docker machine, please use the following command - - mvn clean install -Pdocker -Pit -Pdocker-machine - -## Contact - -Bugs: [issues](https://issues.apache.org/jira/browse/SCB) - -mailing list: [subscribe](mailto:dev-subscr...@servicecomb.incubator.apache.org) [dev](https://lists.apache.org/list.html?d...@servicecomb.apache.org) - - -## Contributing - -See CONTRIBUTING for details on submitting patches and the contribution workflow. - -## Reporting Issues - -See reporting bugs for details about reporting any issues. -- To stop receiving notification emails like this one, please contact liu...@apache.org.
[GitHub] liubao68 closed pull request #708: [SCB-585]update README.md
liubao68 closed pull request #708: [SCB-585]update README.md URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/708 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/README.md b/README.md index f29b1ebf3..c665f2b72 100644 --- a/README.md +++ b/README.md @@ -1,74 +1,30 @@ -# Java Chassis -[![Build Status](https://travis-ci.org/apache/incubator-servicecomb-java-chassis.svg?branch=master)](https://travis-ci.org/apache/incubator-servicecomb-java-chassis?branch=master) [![Coverage Status](https://coveralls.io/repos/github/apache/incubator-servicecomb-java-chassis/badge.svg?branch=master)](https://coveralls.io/github/apache/incubator-servicecomb-java-chassis?branch=master) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.servicecomb/java-chassis-core/badge.svg)](http://search.maven.org/#search%7Cga%7C1%7Corg.apache.servicecomb) [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) +## 本项目是servicecomb-java-chassis开发指南。 -Apache ServiceComb (incubating) Java Chassis is a Software Development Kit (SDK) for rapid development of microservices in Java, providing service registration, service discovery, dynamic routing, and service management features +* [访问地址](https://huaweicse.github.io/servicecomb-java-chassis-doc) -## Quick Start +* 编辑 + 1. Fork本项目代码 + 2. 方式一:直接编辑docs-source里面的md源码 + 3. 方式二:下载[GitBook Editor](https://legacy.gitbook.com/editor)编辑 + 4. 提交PR -Provider service: -```java -import org.apache.servicecomb.*; -@RpcSchema(schemaId = "helloworld") -public class HelloWorldProvider implements HelloWorld { -public String sayHello(String name) { -return "Hello " + name; -} -} -``` +* 发布 + 1. 参考[GitBook安装指南](https://github.com/GitbookIO/gitbook/blob/master/docs/setup.md),安装gitbook + 2. gitbook build . ./docs -Consumer service: -```java -import org.apache.servicecomb.*; -@Component -public class HelloWorldConsumer { - @RpcReference(microserviceName = "pojo", schemaId = "helloworld") - private static HelloWorld helloWorld; +## This project is the servicecomb-java-chassis developers guide - public static void main(String[] args) { - helloWorld.sayHello("Tank"); - } -} -``` +* [Web address](https://huaweicse.github.io/servicecomb-java-chassis-doc) -## Documentation +* Submit PR + 1. Fork this project + 2. Edit md source file, or + 3. Edit using [GitBook Editor](https://legacy.gitbook.com/editor) + 4. Submit PR -Project documentation is available on the [ServiceComb website][servicecomb-website]. +* Publish + 1. see [GitBook installation guide](https://github.com/GitbookIO/gitbook/blob/master/docs/setup.md) + 2. gitbook build . ./docs -[servicecomb-website]: http://servicecomb.incubator.apache.org/ -## Building -You don’t need to build from source to use Java Chassis (binaries in apache nexus ), but if you want to try out the latest and greatest, Java Chassis can be easily built with the maven. You also need JDK 1.8. - - mvn clean install - -If you want to build the release kits from the source - - mvn clean install -Prelease,distribution - -The first build may take a longer than expected as Maven downloads all the dependencies. - -## Automated Testing - - To build the docker image and run the integration tests with docker, you can use maven docker profile - - mvn clean install -Pdocker -Pit - - If you are using docker machine, please use the following command - - mvn clean install -Pdocker -Pit -Pdocker-machine - -## Contact - -Bugs: [issues](https://issues.apache.org/jira/browse/SCB) - -mailing list: [subscribe](mailto:dev-subscr...@servicecomb.incubator.apache.org) [dev](https://lists.apache.org/list.html?d...@servicecomb.apache.org) - - -## Contributing - -See CONTRIBUTING for details on submitting patches and the contribution workflow. - -## Reporting Issues - -See reporting bugs for details about reporting any issues. 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
[GitHub] liubao68 opened a new pull request #708: [SCB-585]update README.md
liubao68 opened a new pull request #708: [SCB-585]update README.md URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/708 Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- 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
[GitHub] coveralls commented on issue #693: [SCB-548] support gracefully shutdown
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/17008695/badge)](https://coveralls.io/builds/17008695) Coverage decreased (-0.5%) to 86.878% when pulling **7c464f4b859cdf9a39954cb6356ff1c93823df53 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 With regards, Apache Git Services
[GitHub] liubao68 opened a new pull request #707: [SCB-585]change folder structure and add compiled pages
liubao68 opened a new pull request #707: [SCB-585]change folder structure and add compiled pages URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/707 Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- 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
[GitHub] liubao68 commented on issue #706: [SCB-585]add ServiceComb-java-chassis reference guide to gh-pages branch
liubao68 commented on issue #706: [SCB-585]add ServiceComb-java-chassis reference guide to gh-pages branch URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/706#issuecomment-389453871 This is a initialization commit, so I merge it without review. We can delete this branch freely if some problems found. 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
[GitHub] zhengyangyong commented on a change in pull request #693: [SCB-548] support gracefully shutdown
zhengyangyong commented on a change in pull request #693: [SCB-548] support gracefully shutdown URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#discussion_r188557220 ## File path: core/src/main/java/org/apache/servicecomb/core/SCBEngine.java ## @@ -0,0 +1,305 @@ +/* + * 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.core; + +import java.util.Collection; +import java.util.concurrent.Semaphore; +import java.util.concurrent.atomic.AtomicLong; + +import org.apache.servicecomb.core.BootListener.BootEvent; +import org.apache.servicecomb.core.BootListener.EventType; +import org.apache.servicecomb.core.definition.loader.SchemaListenerManager; +import org.apache.servicecomb.core.endpoint.AbstractEndpointsCache; +import org.apache.servicecomb.core.event.InvocationFinishEvent; +import org.apache.servicecomb.core.event.InvocationStartEvent; +import org.apache.servicecomb.core.handler.HandlerConfigUtils; +import org.apache.servicecomb.core.provider.consumer.ConsumerProviderManager; +import org.apache.servicecomb.core.provider.producer.ProducerProviderManager; +import org.apache.servicecomb.core.transport.TransportManager; +import org.apache.servicecomb.foundation.common.event.EventManager; +import org.apache.servicecomb.foundation.vertx.VertxUtils; +import org.apache.servicecomb.serviceregistry.RegistryUtils; +import org.apache.servicecomb.serviceregistry.task.MicroserviceInstanceRegisterTask; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.StringUtils; + +import com.google.common.eventbus.AllowConcurrentEvents; +import com.google.common.eventbus.EventBus; +import com.google.common.eventbus.Subscribe; + +// TODO: should not depend on spring, that will make integration more flexible +public class SCBEngine { + private static final Logger LOGGER = LoggerFactory.getLogger(SCBEngine.class); + + private ProducerProviderManager producerProviderManager; + + private ConsumerProviderManager consumerProviderManager; + + private TransportManager transportManager; + + private SchemaListenerManager schemaListenerManager; + + private Collection bootListenerList; + + private final AtomicLong invocationStartedCounter = new AtomicLong(); + + private final AtomicLong invocationFinishedCounter = new AtomicLong(); + + private final Semaphore allInvocationFinished = new Semaphore(1); + + private volatile SCBStatus status = SCBStatus.DOWN; + + public void setStatus(SCBStatus status) { +this.status = status; + } + + private EventBus eventBus = EventManager.getEventBus(); + + private static final SCBEngine INSTANCE = new SCBEngine(); + + public static SCBEngine getInstance() { +return INSTANCE; + } + + public void setProducerProviderManager( + ProducerProviderManager producerProviderManager) { +this.producerProviderManager = producerProviderManager; + } + + public void setConsumerProviderManager( + ConsumerProviderManager consumerProviderManager) { +this.consumerProviderManager = consumerProviderManager; + } + + public TransportManager getTransportManager() { +return transportManager; + } + + public void setTransportManager(TransportManager transportManager) { +this.transportManager = transportManager; + } + + public void setSchemaListenerManager( + SchemaListenerManager schemaListenerManager) { +this.schemaListenerManager = schemaListenerManager; + } + + public Collection getBootListenerList() { +return bootListenerList; + } + + public void setBootListenerList(Collection bootListenerList) { +this.bootListenerList = bootListenerList; + } + + protected void triggerEvent(EventType eventType) { +BootEvent event = new BootEvent(); +event.setEventType(eventType); + +for (BootListener listener : bootListenerList) { + listener.onBootEvent(event); +} + } + + protected void safeTriggerEvent(EventType eventType) { +BootEvent event = new BootEvent(); +event.setEventType(eventType); + +for (BootListener listener : bootListenerList) { + try { +listener.onBootEvent(event); +LOGGER.error("BootListener {} succeed to process {}.",
[GitHub] coveralls commented on issue #705: [SCB-585]add ServiceComb-java-chassis reference guide
coveralls commented on issue #705: [SCB-585]add ServiceComb-java-chassis reference guide URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/705#issuecomment-389453179 [![Coverage Status](https://coveralls.io/builds/17008202/badge)](https://coveralls.io/builds/17008202) Coverage remained the same at 87.371% when pulling **a7cdc514f3376bdeae759b886121996b12d2d51d on liubao68:docs** into **61cda009b7ac8539364bd0f1d1855d804ea4dd27 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 With regards, Apache Git Services
[GitHub] yhs0092 commented on a change in pull request #702: [SCB-580] fix response of the upload file too large
yhs0092 commented on a change in pull request #702: [SCB-580] fix response of the upload file too large URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/702#discussion_r188556614 ## File path: transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestDispatcher.java ## @@ -64,9 +70,106 @@ private void failureHandler(RoutingContext context) { e = cause; } } -restProducerInvocation.sendFailResponse(e); -// 走到这里,应该都是不可控制的异常,直接关闭连接 +// only when unexpected exception happens, it will run into here. +// the connection should be closed. +handleFailureAndClose(context, restProducerInvocation, e); + } + + /** + * Try to find out the failure information and send it in response. + */ + private void handleFailureAndClose(RoutingContext context, AbstractRestInvocation restProducerInvocation, + Throwable e) { +if (null != restProducerInvocation) { + // if there is restProducerInvocation, let it send exception in response. The exception is allowed to be null. + sendFailResponseByInvocation(context, restProducerInvocation, e); + return; +} + +if (null != e) { + // if there exists exception, try to send this exception by RoutingContext + sendExceptionByRoutingContext(context, e); + return; +} + +// if there is no exception, the response is determined by status code. +sendFailureRespDeterminedByStatus(context); + } + + /** + * Try to determine response by status code, and send response. + */ + private void sendFailureRespDeterminedByStatus(RoutingContext context) { +Family statusFamily = Family.familyOf(context.statusCode()); +if (Family.CLIENT_ERROR.equals(statusFamily) || Family.SERVER_ERROR.equals(statusFamily) || Family.OTHER +.equals(statusFamily)) { + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(context.statusCode()).end(); +} else { + // it seems the status code is not set properly + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()) + .setStatusMessage(Status.INTERNAL_SERVER_ERROR.getReasonPhrase()) + .end(wrapResponseBody(Status.INTERNAL_SERVER_ERROR.getReasonPhrase())); +} +context.response().close(); + } + + /** + * Use routingContext to send failure information in throwable. + */ + private void sendExceptionByRoutingContext(RoutingContext context, Throwable e) { +if (InvocationException.class.isInstance(e)) { + InvocationException invocationException = (InvocationException) e; + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(invocationException.getStatusCode()).setStatusMessage(invocationException.getReasonPhrase()) + .end(wrapResponseBody(invocationException.getReasonPhrase())); +} else { + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).end(wrapResponseBody(e.getMessage())); +} +context.response().close(); + } + + /** + * Consumer will treat the response body as json by default, so it's necessary to wrap response body as Json string + * to avoid deserialization error. + * + * @param message response body + * @return response body wrapped as Json string + */ + String wrapResponseBody(String message) { +if (isValidJson(message)) { + return message; +} + +JsonObject jsonObject = new JsonObject(); +jsonObject.put("message", message); + +return jsonObject.toString(); Review comment: Actually I have no idea about what kind of Json response should be written. But I find out that currently we wrap exception and write response like below, so I copy this pattern. ![](https://issues.apache.org/jira/secure/attachment/12923294/12923294_consumerResponse.PNG) 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
[GitHub] liubao68 opened a new pull request #706: [SCB-585]add ServiceComb-java-chassis reference guide to gh-pages branch
liubao68 opened a new pull request #706: [SCB-585]add ServiceComb-java-chassis reference guide to gh-pages branch URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/706 Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- 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
[GitHub] coveralls commented on issue #351: SCB-586 Query providers api will return null when provider is removed
coveralls commented on issue #351: SCB-586 Query providers api will return null when provider is removed URL: https://github.com/apache/incubator-servicecomb-service-center/pull/351#issuecomment-389440283 [![Coverage Status](https://coveralls.io/builds/17007536/badge)](https://coveralls.io/builds/17007536) Coverage increased (+0.01%) to 73.415% when pulling **f428647992e46b227438cddfe163fc0f46317e88 on little-cui:master** into **177d87792754d81bc7c880e637f4fd1c7470a220 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 With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #702: [SCB-580] fix response of the upload file too large
wujimin commented on a change in pull request #702: [SCB-580] fix response of the upload file too large URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/702#discussion_r188543532 ## File path: transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestDispatcher.java ## @@ -64,9 +70,106 @@ private void failureHandler(RoutingContext context) { e = cause; } } -restProducerInvocation.sendFailResponse(e); -// 走到这里,应该都是不可控制的异常,直接关闭连接 +// only when unexpected exception happens, it will run into here. +// the connection should be closed. +handleFailureAndClose(context, restProducerInvocation, e); + } + + /** + * Try to find out the failure information and send it in response. + */ + private void handleFailureAndClose(RoutingContext context, AbstractRestInvocation restProducerInvocation, + Throwable e) { +if (null != restProducerInvocation) { + // if there is restProducerInvocation, let it send exception in response. The exception is allowed to be null. + sendFailResponseByInvocation(context, restProducerInvocation, e); + return; +} + +if (null != e) { + // if there exists exception, try to send this exception by RoutingContext + sendExceptionByRoutingContext(context, e); + return; +} + +// if there is no exception, the response is determined by status code. +sendFailureRespDeterminedByStatus(context); + } + + /** + * Try to determine response by status code, and send response. + */ + private void sendFailureRespDeterminedByStatus(RoutingContext context) { +Family statusFamily = Family.familyOf(context.statusCode()); +if (Family.CLIENT_ERROR.equals(statusFamily) || Family.SERVER_ERROR.equals(statusFamily) || Family.OTHER +.equals(statusFamily)) { + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(context.statusCode()).end(); +} else { + // it seems the status code is not set properly + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()) + .setStatusMessage(Status.INTERNAL_SERVER_ERROR.getReasonPhrase()) + .end(wrapResponseBody(Status.INTERNAL_SERVER_ERROR.getReasonPhrase())); +} +context.response().close(); + } + + /** + * Use routingContext to send failure information in throwable. + */ + private void sendExceptionByRoutingContext(RoutingContext context, Throwable e) { +if (InvocationException.class.isInstance(e)) { + InvocationException invocationException = (InvocationException) e; + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(invocationException.getStatusCode()).setStatusMessage(invocationException.getReasonPhrase()) + .end(wrapResponseBody(invocationException.getReasonPhrase())); +} else { + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).end(wrapResponseBody(e.getMessage())); +} +context.response().close(); + } + + /** + * Consumer will treat the response body as json by default, so it's necessary to wrap response body as Json string + * to avoid deserialization error. + * + * @param message response body + * @return response body wrapped as Json string + */ + String wrapResponseBody(String message) { +if (isValidJson(message)) { + return message; +} + +JsonObject jsonObject = new JsonObject(); +jsonObject.put("message", message); + +return jsonObject.toString(); Review comment: this will produce: { "message": .. } is this we expected? 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
[GitHub] codecov-io commented on issue #351: SCB-586 Query providers api will return null when provider is removed
codecov-io commented on issue #351: SCB-586 Query providers api will return null when provider is removed URL: https://github.com/apache/incubator-servicecomb-service-center/pull/351#issuecomment-389440227 # [Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/351?src=pr=h1) Report > Merging [#351](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/351?src=pr=desc) into [master](https://codecov.io/gh/apache/incubator-servicecomb-service-center/commit/177d87792754d81bc7c880e637f4fd1c7470a220?src=pr=desc) will **decrease** coverage by `0.04%`. > The diff coverage is `63.41%`. [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/351/graphs/tree.svg?width=650=150=pr=GAaF7zrg8R)](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/351?src=pr=tree) ```diff @@Coverage Diff @@ ## master #351 +/- ## == - Coverage 69.92% 69.88% -0.05% == Files 17 18 +1 Lines3418 3420 +2 == Hits 2390 2390 - Misses863 865 +2 Partials 165 165 ``` | [Impacted Files](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/351?src=pr=tree) | Coverage Δ | | |---|---|---| | [server/service/util/dependency.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/351/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvdXRpbC9kZXBlbmRlbmN5Lmdv) | `56.37% <33.33%> (-0.18%)` | :arrow_down: | | [server/service/util/rule\_util.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/351/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvdXRpbC9ydWxlX3V0aWwuZ28=) | `67.5% <40%> (ø)` | :arrow_up: | | [server/service/instances.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/351/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvaW5zdGFuY2VzLmdv) | `71.14% <50%> (+0.01%)` | :arrow_up: | | [server/service/watch.go](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/351/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2Uvd2F0Y2guZ28=) | `70.96% <70.96%> (ø)` | | -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/351?src=pr=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/351?src=pr=footer). Last update [177d877...f428647](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/351?src=pr=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). 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
[GitHub] little-cui opened a new pull request #351: SCB-586 Query providers api will return null when provider is removed
little-cui opened a new pull request #351: SCB-586 Query providers api will return null when provider is removed URL: https://github.com/apache/incubator-servicecomb-service-center/pull/351 Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `go build` `go test` `go fmt` `go vet` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- 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
[GitHub] coveralls commented on issue #702: [SCB-580] fix response of the upload file too large
coveralls commented on issue #702: [SCB-580] fix response of the upload file too large URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/702#issuecomment-36098 [![Coverage Status](https://coveralls.io/builds/17006777/badge)](https://coveralls.io/builds/17006777) Coverage increased (+0.03%) to 87.372% when pulling **05edc951bdacc4f39501be8fad119f63dd971c29 on yhs0092:fix_response_of_the_upload_file_too_large** into **2f8de349d4b0b82d3dc14fcb9c94d3ae7046f9b5 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 With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #627: [SCB-292] chassis support standard parameter validation
wujimin commented on a change in pull request #627: [SCB-292] chassis support standard parameter validation URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/627#discussion_r188527793 ## File path: demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/JaxrsClient.java ## @@ -147,4 +169,85 @@ private static void testRawJsonParam(RestTemplate template, String cseUrlPrefix) TestMgr.check("hello Tom", template.postForObject(cseUrlPrefix + "/compute/testrawjson", jsonPerson, String.class)); } + + private static void testValidatorAddFail(RestTemplate template, String cseUrlPrefix) { +Mapparams = new HashMap<>(); +params.put("a", "5"); +params.put("b", "3"); +boolean isExcep = false; +try { + template.postForObject(cseUrlPrefix + "add", params, Integer.class); +} catch (InvocationException e) { + isExcep = true; + TestMgr.check(400, e.getStatus().getStatusCode()); + TestMgr.check(Status.BAD_REQUEST, e.getReasonPhrase()); + TestMgr.check( + "CommonExceptionData [message=[ConstraintViolationImpl{interpolatedMessage='must be greater than or equal to 20', propertyPath=add.arg1, rootBeanClass=class org.apache.servicecomb.demo.jaxrs.server.Validator, messageTemplate='{javax.validation.constraints.Min.message}'}]]", Review comment: it's not about test case.. root cause is that developer use exception.toString to be response information. 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
[GitHub] liubao68 opened a new pull request #705: [SCB-585]add ServiceComb-java-chassis reference guide
liubao68 opened a new pull request #705: [SCB-585]add ServiceComb-java-chassis reference guide URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/705 Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- 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
[GitHub] yhs0092 commented on a change in pull request #702: [SCB-580] fix response of the upload file too large
yhs0092 commented on a change in pull request #702: [SCB-580] fix response of the upload file too large URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/702#discussion_r188522352 ## File path: transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestDispatcher.java ## @@ -64,9 +69,85 @@ private void failureHandler(RoutingContext context) { e = cause; } } -restProducerInvocation.sendFailResponse(e); -// 走到这里,应该都是不可控制的异常,直接关闭连接 +// only when unexpected exception happens, it will run into here. +// the connection should be closed. +handleFailureAndClose(context, restProducerInvocation, e); + } + + /** + * Try to find out the failure information and send it in response. + */ + private void handleFailureAndClose(RoutingContext context, AbstractRestInvocation restProducerInvocation, + Throwable e) { +if (null != restProducerInvocation) { + // if there is restProducerInvocation, let it send exception in response. The exception is allowed to be null. + sendFailResponseByInvocation(context, restProducerInvocation, e); + return; +} + +if (null != e) { + // if there exists exception, try to send this exception by RoutingContext + sendExceptionByRoutingContext(context, e); + return; +} + +// if there is no exception, the response is determined by status code. +sendFailureRespDeterminedByStatus(context); + } + + /** + * Try to determine response by status code, and send response. + */ + private void sendFailureRespDeterminedByStatus(RoutingContext context) { +Family statusFamily = Family.familyOf(context.statusCode()); +if (Family.CLIENT_ERROR.equals(statusFamily) || Family.SERVER_ERROR.equals(statusFamily) || Family.OTHER +.equals(statusFamily)) { + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(context.statusCode()).end(); +} else { + // it seems the status code is not set properly + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()) + .setStatusMessage(Status.INTERNAL_SERVER_ERROR.getReasonPhrase()) + .end(wrapResponseBody(Status.INTERNAL_SERVER_ERROR.getReasonPhrase())); +} +context.response().close(); + } + + /** + * Use routingContext to send failure information in throwable. + */ + private void sendExceptionByRoutingContext(RoutingContext context, Throwable e) { +if (InvocationException.class.isInstance(e)) { + InvocationException invocationException = (InvocationException) e; + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(invocationException.getStatusCode()).setStatusMessage(invocationException.getReasonPhrase()) + .end(wrapResponseBody(invocationException.getReasonPhrase())); +} else { + context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) + .setStatusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).end(wrapResponseBody(e.getMessage())); +} +context.response().close(); + } + + /** + * Consumer will treat the response body as json by default, so it's necessary to wrap response body with "" + * to avoid deserialization error. + * + * @param message response body + * @return response body wrapped with "" + */ + private String wrapResponseBody(String message) { +return "\"" + message + "\""; Review comment: I've done it. Thanks to the powerful special char escape ability of Vertx's JsonObject, it's not so complex as I expected. In the UT testWrapResponseBody, you can see that JsonObject can handle special char well. 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
[GitHub] coveralls commented on issue #704: [SCB-582]Provide a way to protect instance removal
coveralls commented on issue #704: [SCB-582]Provide a way to protect instance removal URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/704#issuecomment-389173534 [![Coverage Status](https://coveralls.io/builds/17006380/badge)](https://coveralls.io/builds/17006380) Coverage decreased (-0.04%) to 87.306% when pulling **de3635f4ccf7f7144aae2d8f71383a37f51fee05 on liubao68:instance_protection** into **2f8de349d4b0b82d3dc14fcb9c94d3ae7046f9b5 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 With regards, Apache Git Services
[GitHub] liubao68 commented on issue #704: [SCB-582]Provide a way to protect instance removal
liubao68 commented on issue #704: [SCB-582]Provide a way to protect instance removal URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/704#issuecomment-389408719 Change the behavior to only protect empty instances and make this behavior on default. 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