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
Remove unnecessary intermediate interfaces #6517
Conversation
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.threadpool.ThreadPool; | ||
|
||
/** | ||
*/ | ||
public abstract class FilterClient implements InternalClient { |
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.
was wondering if it makes sense to move this base class outside of test as I could use it in #6513 as well.
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.
+1 I think you should do that in #6513
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.
yep makes sense
LGTM, very nice improvement |
can we also consider having one base interface for all clients... the all have the same |
@uboness I am working on makeing things more generic as we speak I think having a single execute method would make sense. Lemme see how it goes |
awesome! thx |
@uboness here are some updates I think we are close? |
* Closes the client. | ||
*/ | ||
void close(); | ||
public interface Client extends ElasticsearchClient<Client>, Closeable { |
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.
Can you mention issue #4355 in the commit that makes Client
implement Closeable
? Also we might want to do the same with Node
.
This looks great. We might want to make clients extend |
I LOVE IT!!! left a small comment on naming... but other than that LGTM |
I pushed the fixes for the comments and added some more javadocs. I think it's ready! @javanna I will include the issue in the final commit message |
* Util method that casts to the client base class for use inside the exectue methods only. | ||
* This method allows to provide yet another client that is used to execute the actual remote calls. | ||
*/ | ||
protected ElasticsearchClient executor() { |
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.
aren't we missing a generic type here? ElasticsearchClient<Client>
I left a few comments on generics types missing, other than that LGTM!!! |
Client, ClusterAdminClient and IndicesAdminClient had corresponding intermediate `internal` interfaces that are unnecessary and cause a lot of casting. This commit removes the intermediate interfaces and uses the super interfaces directly. This commit also adds Releaseable to `Node` and `Client` in order to be used with utilities like try / with. Closes elastic#4355 Closes elastic#6517
I mark this as breaking since it changes class hierarchies... yet, I don't think users will be affected since they only use the final classes rather than internal once... thanks for the reviews... |
Client, ClusterAdminClient and IndicesAdminClient had corresponding intermediate `internal` interfaces that are unnecessary and cause a lot of casting. This commit removes the intermediate interfaces and uses the super interfaces directly. This commit also adds Releaseable to `Node` and `Client` in order to be used with utilities like try / with. Closes #4355 Closes #6517
After elastic#6517 we ended up registering all of the actions (included admin ones) to the NodeClient. Made sure that only the proper type of Action instances are registered to each client type. Also fixed some compiler warnings: unused members, imports and non matching generic types. Closes elastic#6563
Client
,ClusterAdminClient
andIndicesAdminClient
had corresponding intermediateinternal
interfaces that are unnecessary and cause a lot of casting. This commit removes the intermediate interfaces and uses the super interfaces directly.This PR also simplifys
FilterClient
by subclassingAbstractClient
Closes #4355