-
Notifications
You must be signed in to change notification settings - Fork 826
JAV-479 Discovery optimize #261
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
…anged URL cause vertx found wrong failureHandler solution:changed URL only saved in VertxServerRequestToHttpServletRequest, not save to HttpServerRequest
context.setCurrentNode(parent); | ||
|
||
DiscoveryTreeNode child = filter.discovery(context, parent); | ||
if (child == 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 child is null, will generate a NullPointerException, it's the same
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, but from null exception, we can not know which filter throw it.
return data == null; | ||
} | ||
|
||
private boolean isMapEmpty() { |
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 the data is not a map , we will get the class case exception.
I don't like these three method.
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, i don't like this too.
but data in cache is not always the same type.
eg: in discoveryTree, before endpointFilter, discoveryTreeNode data is Map<String, MicroserviceInstance>, after endpointFilter, discoverTreeNode data is Collection<Endpoint> or Collection<CseServer>
caller know what's data type in cache, and call different method, if invoke wrong method, then it's a bug, developers should fix it.
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.
isXXXEmpty methods have no problems, because they are private, and used by data type.
not so good methods are: mapData/collectionData/arrayData
details is in https://servicecomb.atlassian.net/browse/JAV-479
in this issue, create new filter mechanism, old filters will rewrite in new Filter later.