You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/10/17 00:29:46 UTC
[GitHub] [pulsar] merlimat commented on a change in pull request #12390: Allow to have different instances LocalMemoryMetadataStore that share the same state
merlimat commented on a change in pull request #12390:
URL: https://github.com/apache/pulsar/pull/12390#discussion_r730318711
##########
File path: pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/LocalMemoryMetadataStore.java
##########
@@ -55,56 +62,85 @@
private final NavigableMap<String, Value> map;
private final AtomicLong sequentialIdGenerator;
- public LocalMemoryMetadataStore(String metadataURL, MetadataStoreConfig metadataStoreConfig) {
- map = new TreeMap<>();
- sequentialIdGenerator = new AtomicLong();
- }
-
- @Override
- public synchronized CompletableFuture<Optional<GetResult>> get(String path) {
- if (!isValidPath(path)) {
- return FutureUtils.exception(new MetadataStoreException(""));
+ private static final Map<String, NavigableMap<String, Value>> STATIC_MAPS = new MapMaker()
+ .weakValues().makeMap();
+ private static final Map<String, AtomicLong> STATIC_ID_GEN_MAP = new MapMaker()
Review comment:
It's a static map, so it would be never cleaned up otherwise.
It will not make the test unpredictable because there will be hard references to the map value for each instance of `LocalMemoryMetadataStore` that will keep it from getting GCed.
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org