You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2022/04/09 20:19:38 UTC
[GitHub] [calcite] zabetak commented on a diff in pull request #2698: [CALCITE-4992] Close the ElasticSearch RestClient in ElasticsearchTransport
zabetak commented on code in PR #2698:
URL: https://github.com/apache/calcite/pull/2698#discussion_r846676962
##########
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java:
##########
@@ -53,6 +60,24 @@
private static final Logger LOGGER = LoggerFactory.getLogger(ElasticsearchSchemaFactory.class);
+ // RestClient objects allocate system resources and are thread safe. Here, we
+ // cache them using a key derived from the hashCode()s of the parameters that
+ // define a RestClient.
+ private static Cache<Integer, RestClient> restClients = CacheBuilder.newBuilder()
+ .maximumSize(1000)
Review Comment:
What happens if after one hour the client is removed and closed but there is still an active reference inside the `ElasticsearchSchema`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org