-
Notifications
You must be signed in to change notification settings - Fork 827
JAV-214 avoid NullPointerException in register task, let it try to register again #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
avoid NullPointerException in register task
|
||
private void checkSchemaIdSet() { | ||
Microservice existMicroservice = srClient.getMicroservice(microservice.getServiceId()); | ||
if (existMicroservice == null) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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,
There was a problem hiding this comment.
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.
There was a problem hiding this 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个什么场景下会为空?
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
localSchemas, | ||
existSchemas); | ||
return; | ||
return true; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
avoid NullPointerException in register task.