eolivelli commented on a change in pull request #12390:
URL: https://github.com/apache/pulsar/pull/12390#discussion_r730300814
##########
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:
Why weak values?
This will make tests possible unpredictable, because eviction will depend on
GC
##########
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:
Why weak values?
This will make tests possible unpredictable, because eviction will depend on
GC
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]