JAV-214 avoid NullPointerException in register task, let it try to register again#90
JAV-214 avoid NullPointerException in register task, let it try to register again#90seanyinx merged 3 commits intoapache:masterfrom ShakespeareLiu:master
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.
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.
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.
i feel that, it should be treat as register microservice failed, and reset the service center task like register instance failed.
liubao68
left a comment
There was a problem hiding this comment.
这个是一个可靠性问题,在服务中心出错的时候。但是出现问题的概率会很低。 修改方法建议要调整下。提交了一个issue:https://servicecomb.atlassian.net/browse/JAV-214
|
|
||
| private void checkSchemaIdSet() { | ||
| Microservice existMicroservice = srClient.getMicroservice(microservice.getServiceId()); | ||
| if (existMicroservice == null) { |
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.
shall we return true or false in case the schema mismatches?
There was a problem hiding this comment.
this flag just judges whether get the microservice schema dates successfully, another flag "schemaIdSetMatch" judges whether the schema matches.
avoid NullPointerException in register task.