Skip to content

Conversation

ShakespeareLiu
Copy link

avoid NullPointerException in register task.

avoid NullPointerException in register task
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 85.181% when pulling 8e1baab on ShakespeareLiu:master into ace8b8d on ServiceComb:master.


private void checkSchemaIdSet() {
Microservice existMicroservice = srClient.getMicroservice(microservice.getServiceId());
if (existMicroservice == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only happened when the microservice been deleted after "srClient.getMicroserviceId".
if this happened, it's wrong to just log and return, because we need to reregister the microservice or just refused boot.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, maybe is not the properly way to just return. I found this problem when the connection to Service Center is not stable. sdk is failed to update heartbeat to SC or any time when sdk register to SC. but if the register thread exits, it will not cover any more even next time sdk could update heartbeat successfully ,it's an improvement issue,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel that, it should be treat as register microservice failed, and reset the service center task like register instance failed.

Copy link
Contributor

@liubao68 liubao68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是一个可靠性问题,在服务中心出错的时候。但是出现问题的概率会很低。 修改方法建议要调整下。提交了一个issue:https://servicecomb.atlassian.net/browse/JAV-214


private void checkSchemaIdSet() {
Microservice existMicroservice = srClient.getMicroservice(microservice.getServiceId());
if (existMicroservice == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个什么场景下会为空?

ShakespeareLiu added 2 commits July 21, 2017 17:27
if failed to get microservice from service center, then failed in register, let it try again
check schemaId set failed when get microservice from service center
@ShakespeareLiu ShakespeareLiu changed the title Update MicroserviceRegisterTask.java JAV-214 avoid NullPointerException in register task, let it try to register again Jul 21, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 85.204% when pulling 712ba1f on ShakespeareLiu:master into ace8b8d on ServiceComb:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.003%) to 85.227% when pulling 712ba1f on ShakespeareLiu:master into ace8b8d on ServiceComb:master.

localSchemas,
existSchemas);
return;
return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we return true or false in case the schema mismatches?

Copy link
Author

@ShakespeareLiu ShakespeareLiu Jul 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this flag just judges whether get the microservice schema dates successfully, another flag "schemaIdSetMatch" judges whether the schema matches.

@seanyinx seanyinx merged commit f52d65e into apache:master Jul 24, 2017
@WillemJiang WillemJiang modified the milestone: 0.2.0 Aug 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants