eolivelli commented on a change in pull request #9967:
URL: https://github.com/apache/pulsar/pull/9967#discussion_r597466038
##########
File path:
pulsar-discovery-service/src/test/java/org/apache/pulsar/discovery/service/web/DiscoveryServiceWebTest.java
##########
@@ -78,10 +80,14 @@
*/
public class DiscoveryServiceWebTest extends BaseZKStarterTest{
+ private static final Logger log =
LoggerFactory.getLogger(DiscoveryServiceWebTest.class);
+
private Client client = ClientBuilder.newClient(new
ClientConfig().register(LoggingFeature.class));
private static final String TLS_SERVER_CERT_FILE_PATH =
"./src/test/resources/certificate/server.crt";
private static final String TLS_SERVER_KEY_FILE_PATH =
"./src/test/resources/certificate/server.key";
-
+ // DiscoveryServiceServlet gets initialized by a server and this map will
help to retrieve ZK while mocking
+ // DiscoveryServiceServlet
+ private static final Map<String, MetadataStoreExtended>
metadataStoreInstanceCache = Maps.newConcurrentMap();
Review comment:
I am fine with having the static map. it is a good idea.
I would only add a
```
@AlfterClass
public void clearMetadataStoreInstanceCache() {
metadataStoreInstanceCache.clear();
}
```
if we do not clear the map then we are keeping a reference to the (closed)
MetadataStore into a static variable.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]